# Push Notifications not received

**URL:** <https://community.parseplatform.org/t/push-notifications-not-received/122>\
**Category:** Parse Server 📡\
**Tags:** push-notifications\
**Created:** [April 9, 2020, 8:30am UTC](https://community.parseplatform.org/t/push-notifications-not-received/122 "2020-04-09T08:30:48Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![splitlamp](https://community.parseplatform.org/letter_avatar_proxy/v4/letter/s/f14d63/32.png) [@splitlamp](https://community.parseplatform.org/u/splitlamp)\
**Post date:** [April 9, 2020, 8:30am UTC](https://community.parseplatform.org/t/push-notifications-not-received/122/1 "2020-04-09T08:30:48Z")

</div>

I am trying to configure a Docker-based deployment of Parse server with push notifications.

The server is up and running, including the push notification settings as environment variables. The `.p12` used was the “Development SSL Certificate” associated to the Push Notification settings of my in-development iOS app (the `.cer` file was downloaded, double-clicked to import to my Keychain, then exported as `.p12`)

This environment variable is as follows:  
` - PARSE_SERVER_PUSH={"ios":{"pfx":"/opt/bitnami/parse/pushcert/Parse-App-Name.APS_Dev.Export.p12","topic":"com.domain.Parse-App-Name","production":false}}`

I have followed guides at various locations:

- [Ray Wenderlich](https://www.raywenderlich.com/8164-push-notifications-tutorial-getting-started) and [another about Parse](https://www.raywenderlich.com/717-parse-server-tutorial-with-ios)

- [Appcoda](https://www.appcoda.com/push-notification-ios/)

- [Parse’s own Guides](https://docs.parseplatform.org/parse-server/guide/#push-notifications), right down to the section on adding my device to Parse with PFInstallation

From this configuration, I have run the iOS app a couple times, so it has asked for push notification permission and completed the registration / installation of the device into Parse. If I go to the Parse Dashboard, and attempt to `Send New Push` I can see my single device / audience.

However, using the Dashboard to send a message, it is never received. Selecting this previously sent message, shows:

 ![image](https://parse-community-forum-uploads.s3.dualstack.us-east-1.amazonaws.com/original/1X/75c344a63c8eae5b997caef021c98a8f0203f303.png)

Separately, I downloaded a Mac app, `APNS-Tool`, from the Mac App Store that assists with development. I can send direct push notifications by providing the device’s token (obtained from the app running), the development certificate (the same source certificate of my Parse server’s `.p12` file), and these are received. This tells me that the setup I have _ **should** _ work, but doesn’t…

Anyone able to assist?

---

<div class="post-metadata">

**Author:** ![splitlamp](https://community.parseplatform.org/letter_avatar_proxy/v4/letter/s/f14d63/32.png) [@splitlamp](https://community.parseplatform.org/u/splitlamp)\
**Post date:** [April 9, 2020, 3:58pm UTC](https://community.parseplatform.org/t/push-notifications-not-received/122/2 "2020-04-09T15:58:54Z")

</div>

Some additional info, as I saw some material on [Apple’s site](https://developer.apple.com/documentation/usernotifications/setting_up_a_remote_notification_server/handling_notification_responses_from_apns) for troubleshooting APNs.

This is deployed on a single Docker host with Parse running against my local network’s server hostname. When I run my test iOS app, the AppDelegate is set to use this internal URL name, such as:  
`http://localserver.home.local:1337/parse`

I have multiple websites / services running from port 80 & 443 to allow web hosting running from the same home server, with other Docker containers handling reverse-proxying and LetsEncrypt SSL. So my Parse container doesn’t have an internet routable path via port 443 as mentioned in the above document. I would have the same issue with the other port 2195.

I have not seen any reference to this in the guides / tutorials for this, and my container is able to reach outbound to the internet. Inbound is restricted.

Following more documentation, from my Docker host, running the test push notification `curl` command:

```
curl -X POST \
  -H "X-Parse-Application-Id: myappID" \
  -H "X-Parse-Master-Key: mymasterKey" \
  -H "Content-Type: application/json" \
  -d '{
        "where": {
          "deviceType": {
            "$in": [
              "ios"
            ]
          }
        },
        "data": {
          "title": "The Shining",
          "alert": "All work and no play makes Jack a dull boy.",
          "content-available": 1,
          "push_type": "background"
        }
      }'\ http://server.home.local/parse/push

```

(Note, also tried “push-type”)

I receive this in the terminal:

```
<html>
<head><title>503 Service Temporarily Unavailable</title></head>
<body>
<center><h1>503 Service Temporarily Unavailable</h1></center>
<hr><center>nginx/1.17.6</center>
</body>
</html>
```

---

<div class="post-metadata">

**Author:** ![splitlamp](https://community.parseplatform.org/letter_avatar_proxy/v4/letter/s/f14d63/32.png) [@splitlamp](https://community.parseplatform.org/u/splitlamp)\
**Post date:** [April 10, 2020, 8:44am UTC](https://community.parseplatform.org/t/push-notifications-not-received/122/3 "2020-04-10T08:44:33Z")

</div>

So I have been able to progress the response / error below:

> [@splitlamp](#):
>
> I receive this in the terminal:
> 
> ```auto
> <html>
> <head><title>503 Service Temporarily Unavailable</title></head>
> <body>
> <center><h1>503 Service Temporarily Unavailable</h1></center>
> <hr><center>nginx/1.17.6</center>
> </body>
> </html>
> 
> ```

In the CURL command, the connection string example didn’t include the port number, so I also omitted it. Adding in the custom port number I am using, `1338` in my case, this command:

```
curl -X POST \
> -H "X-Parse-Application-Id: myappID" \
> -H "X-Parse-Master-Key: mymasterKey" \
> -H "Content-Type: application/json" \
> -d '{
> "where": {
> "deviceType": {
> "$in": [
> "ios"
> ]
> }
> },
> "data": {
> "title": "The Shining",
> "alert": "All work and no play makes Jack a dull boy.",
> "push-type": "background"
> }
> }'\
> http://server.home.local:1338/parse/push

```

Returns:  
`{"result":true}`

And if I return to the Dashboard, under the Push menu \> Past Pushes, I can see all these requests.

However, NONE are actually received on the device!

I have tried some variations in the `data` JSON object, including extra parameters that seem to be now be required iOS 13 devices, namely:

- push-type / push\_type / apns-push-type

- content-available

I think I have tried all combinations, but still no received notification…

Not sure what or where to look now…  
What tests and/or logs are available between my Parse server and Apple’s APNS servers?

---

<div class="post-metadata">

**Author:** ![davimacedo](https://community.parseplatform.org/user_avatar/community.parseplatform.org/davimacedo/32/316_2.png) [@davimacedo](https://community.parseplatform.org/u/davimacedo)\
**Post date:** [April 29, 2020, 9:28pm UTC](https://community.parseplatform.org/t/push-notifications-not-received/122/4 "2020-04-29T21:28:19Z")

</div>

Have you added the client code to save the installations? Can you share some of the installations that should receive the push?

---

<div class="post-metadata">

**Author:** ![lsmilek1](https://community.parseplatform.org/user_avatar/community.parseplatform.org/lsmilek1/32/629_2.png) [@lsmilek1](https://community.parseplatform.org/u/lsmilek1)\
**Post date:** [October 4, 2021, 3:06pm UTC](https://community.parseplatform.org/t/push-notifications-not-received/122/5 "2021-10-04T15:06:42Z")

</div>

I am now also learning how to properly send push with Parse and I found similar issue. I am saving Installation and when have following testing code in the cloud trigger, the device receives the push:

```javascript
Parse.Cloud.afterSave("Inbox", async ({object, log}) => {
    const rid = object.get("rid");
    if (object.existed() || !rid) {
        //proceed only if new object and recipient id is defined        
        return;
    }
    const query = new Parse.Query(Parse.Installation);
    query.equalTo("userId", rid);

    return Parse.Push.send({
        where: query,
        data: { 
            alert: "Inbox"/*, 
            push_type: "background" */
        }
    }, { useMasterKey: true }).then(function() {
        // Push sent!
    }, function(error) {
        log.error(`Error sending push notification on new Inbox ${error.code}: ${error.message}`);
    });
    
});

```

but when I uncomment that `push_type: "background"`, the notification is not received. I mean not even in the application delegate as it should be silent one… In the documentation I have not found any example for iOs silent notification with some data payload.

When I tried to add custom field, it was received:

```javascript
Parse.Push.send({
        where: query,
        data: { 
            alert: "Inbox",
            customField: 12/*, 
            push_type: "background" */
        }
    }, { useMasterKey: true }).then(function() {
        // Push sent!
    }, function(error) {
        log.error(`Error sending push notification on new Inbox ${error.code}: ${error.message}`);
    });

```

Xcode Debug:

> **userInfo: [AnyHashable(“customField”): 12, AnyHashable(“aps”): {alert = Inbox;}]**

unfortunately with the `push_type: "background"` uncommented, the notification was not received by client

---

<div class="post-metadata">

**Author:** ![davimacedo](https://community.parseplatform.org/user_avatar/community.parseplatform.org/davimacedo/32/316_2.png) [@davimacedo](https://community.parseplatform.org/u/davimacedo)\
**Post date:** [October 4, 2021, 3:15pm UTC](https://community.parseplatform.org/t/push-notifications-not-received/122/6 "2021-10-04T15:15:21Z")

</div>

Would you mind to share the client code that you are using to receive the push?

---

<div class="post-metadata">

**Author:** ![lsmilek1](https://community.parseplatform.org/user_avatar/community.parseplatform.org/lsmilek1/32/629_2.png) [@lsmilek1](https://community.parseplatform.org/u/lsmilek1)\
**Post date:** [October 4, 2021, 3:17pm UTC](https://community.parseplatform.org/t/push-notifications-not-received/122/7 "2021-10-04T15:17:26Z")

</div>

I am so far only printing userInfo in the delegate function:

```auto
func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
        print("!! didReceiveRemoteNotification userInfo: \(userInfo)")
    }

```

---

<div class="post-metadata">

**Author:** ![lsmilek1](https://community.parseplatform.org/user_avatar/community.parseplatform.org/lsmilek1/32/629_2.png) [@lsmilek1](https://community.parseplatform.org/u/lsmilek1)\
**Post date:** [October 5, 2021, 8:17am UTC](https://community.parseplatform.org/t/push-notifications-not-received/122/8 "2021-10-05T08:17:03Z")

</div>

After further investigation I noticed that following variation is being received:

```swift
Parse.Push.send({
        where: query,
        data: { 
            "content-available": 1,
            "push_type": "background",
            "customField": 12
        }
    }, { useMasterKey: true })

```

> **userInfo: [AnyHashable(“push\_type”): background, AnyHashable(“customField”): 12, AnyHashable(“aps”): {**  
> **“content-available” = 1;**  
> **}]**

Unfortunately it is also not waking the app and I can’t figure out if it is the xcode side or push side. If anyone would have experience on that, I would greatly appreciate the help. Thank you

---

<div class="post-metadata">

**Author:** ![cbaker6](https://community.parseplatform.org/user_avatar/community.parseplatform.org/cbaker6/32/114_2.png) [@cbaker6](https://community.parseplatform.org/u/cbaker6)\
**Post date:** [October 5, 2021, 11:14am UTC](https://community.parseplatform.org/t/push-notifications-not-received/122/9 "2021-10-05T11:14:31Z")

</div>

> [@lsmilek1](#):
>
> Unfortunately it is also not waking the app and I can’t figure out if it is the xcode side or push side. If anyone would have experience on that, I would greatly appreciate the help. Thank you

Did you try it out on a physical device? Unless something has changed in Xcode that I’m unaware of, the iOS simulator isn’t allowed to receive remote push notifications.

Update: there have been some changes. Do you receive notifications when you follow the article: [Testing push notifications on the iOS simulator - SwiftLee](https://www.avanderlee.com/workflow/testing-push-notifications-ios-simulator/)

---

<div class="post-metadata">

**Author:** ![lsmilek1](https://community.parseplatform.org/user_avatar/community.parseplatform.org/lsmilek1/32/629_2.png) [@lsmilek1](https://community.parseplatform.org/u/lsmilek1)\
**Post date:** [October 5, 2021, 11:21am UTC](https://community.parseplatform.org/t/push-notifications-not-received/122/10 "2021-10-05T11:21:39Z")

</div>

Yes, I am testing it on a physical device, otherwise there is also no notification received in the simulator foreground. Reading on the internet I found that:

- silent notification are throttled and there should not be more than 3/hour
- silent notifications are not received when user terminated the app in app switcher

Therefore it is not suitable for my needs and I am trying to implement `UNNotificationServiceExtension` instead.

---

<div class="post-metadata">

**Author:** ![sokel](https://community.parseplatform.org/letter_avatar_proxy/v4/letter/s/91b2a8/32.png) [@sokel](https://community.parseplatform.org/u/sokel)\
**Post date:** [February 6, 2022, 1:02pm UTC](https://community.parseplatform.org/t/push-notifications-not-received/122/11 "2022-02-06T13:02:29Z")

</div>

I am struggling with the same issue that is to receive a push notification with afterSave() cloud code and I am receiving PushStaus summary { BadDeviceToken: 1 and success: 0; what could be the reason? Is it the token format, or it has to do with communicating with APNs?

Parse.Cloud.afterSave(“Tasks”, function(request) {

const content = request.object.get(‘TaskMessage’);  
const pushTo = request.object.get(‘UserNameTo’);  
const sender = request.object.get(‘UserNameFrom’);  
const deadline = request.object.get(‘TaskDeadline’);

let query = new Parse.Query(Parse.Installation);  
query.equalTo(“userId”, pushTo);  
query.descending(“updatedAt”);  
return Parse.Push.send({  
where: query,  
data: {  
title: "New request for action from " + sender,  
alert: content + " deadline set to " + deadline,  
badge: “Increment”,  
sound: “default”  
}

}, { useMasterKey: true});  
});

PARSE INFO LOGS

2022-02-06T11:47:23.822Z - PushStatus wkBEpEm78k: {“summary”:{“BadDeviceToken”:1,“success”:0},“where”:{“[userId":"muadi.ilung@gmail.com](mailto:userId%22:%22muadi.ilung@gmail.com)”},“query”:{}}

2022-02-06T11:47:23.679Z - All 1 packages were enqueued for PushStatus wkBEpEm78k

2022-02-06T11:47:23.676Z - Ran cloud function createTask for user apu3UfAqw1 with:  
Input: {“[userto":"muadi.ilung@gmail.com](mailto:userto%22:%22muadi.ilung@gmail.com)”,“taskdeadline”:“Feb 8, 2022”,“taskmessage”:“testing another push”}  
Result: [{“TaskDeadline”:{"\_\_type":“Date”,“iso”:“2021-09-17T04:00:00.000Z”},“[UserNameTo":"irialy.ilung@gmail.com](mailto:UserNameTo%22:%22irialy.ilung@gmail.com)”,“userTo”:{"\_\_type":“Pointer”,“className”:"\_User",“objectId”:“nMDEH6Dgnk”},“TaskMessage”:“Recruitment for procurement officer”,“TaskLogo”:“💡”,“userFrom”:{"\_\_type":“Pointer”,“className”:"\_User",“objectId”:“apu3UfAqw1”},“[UserNameFrom":"muadi.ilung@gmail.com](mailto:UserNameFrom%22:%22muadi.ilung@gmail.com)”,“TaskStatus”:“Read”,“ActionLogo”:“🗣”,“createdAt”:“2021-09-16T17:20:05.895Z”,“updatedAt”:“2022-01-29T11:59:15.736Z”,“message\_logo”:“📝”,“Active”:true,“objectId”:“XMgirR8ASF”,"\_\_type":“Object”,“className”:“Tasks”},{“TaskDeadline”:{"\_\_type":“Date”,“iso”:“2021-10-21T12:16:28.000Z”},“[UserNameTo":"irialy.ilung@gmail.com](mailto:UserNameTo%22:%22irialy.ilung@gmail.com)”,“userTo”:{"\_\_type":“Pointer”,“className”:"\_User",“objectId”:“nMDEH6Dgnk”},“TaskMessage”:“Develop and standardize a procedure for rounding numbers in order to provide consistency in calculating and reporting results”,“TaskLogo”:“↪”,“userFrom”:{"\_\_type":“Pointer”,“className”:"\_User",“objectId”:“apu3UfAqw1”},"UserNameFr… (truncated)

2022-02-06T11:47:23.667Z - afterSave triggered for Tasks for user undefined:  
Input: {“TaskDeadline”:{"\_\_type":“Date”,“iso”:“2022-02-08T00:00:00.000Z”},“TaskMessage”:“testing another [push",“UserNameFrom”:"muadi.ilung@gmail.com](mailto:push%22,%22UserNameFrom%22:%22muadi.ilung@gmail.com)”,“UserNameTo”:"muadi.ilung@gmail.com",“TaskStatus”:“Not Read”,“TaskLogo”:“👤”,“ActionLogo”:“🗣”,“userFrom”:{"\_\_type":“Pointer”,“className”:"\_User",“objectId”:“apu3UfAqw1”},“userTo”:{"\_\_type":“Pointer”,“className”:"\_User",“objectId”:“apu3UfAqw1”},“Active”:true,“createdAt”:“2022-02-06T11:47:23.658Z”,“updatedAt”:“2022-02-06T11:47:23.658Z”,“objectId”:“6oeBHCVJf7”}  
Result: {“result”:true}

2022-02-06T11:47:23.661Z - afterSave triggered for Tasks for user undefined:  
Input: {“TaskDeadline”:{"\_\_type":“Date”,“iso”:“2022-02-08T00:00:00.000Z”},“TaskMessage”:“testing another [push",“UserNameFrom”:"muadi.ilung@gmail.com](mailto:push%22,%22UserNameFrom%22:%22muadi.ilung@gmail.com)”,“UserNameTo”:"muadi.ilung@gmail.com",“TaskStatus”:“Not Read”,“TaskLogo”:“👤”,“ActionLogo”:“🗣”,“userFrom”:{"\_\_type":“Pointer”,“className”:"\_User",“objectId”:“apu3UfAqw1”},“userTo”:{"\_\_type":“Pointer”,“className”:"\_User",“objectId”:“apu3UfAqw1”},“Active”:true,“createdAt”:“2022-02-06T11:47:23.658Z”,“updatedAt”:“2022-02-06T11:47:23.658Z”,“objectId”:“6oeBHCVJf7”}
