APNS push is not received by device when sent via backend despite 200 OK response received

I am attempting to send a push notification via APNS from a supabase edge function (deno/typescript). I receive a 200 OK response from APNS, and using the "apns-unique-id" I am able to look up the notification in the dashboard which shows the notification was successfully sent to the device. However the app/device does not receive the push.

Using the dashboard, I can successfully send a test push to the device, and I also have FCM already implemented and working, so I assume the iOS/client-side setup is not the problem. I also verified that my generated JWT and device token are valid via the dashboard, plus I'm getting 200 back with the request, so I also assume that auth is not an issue either. Yet even with a simple alert payload such as below, nothing comes through.

What else could be causing this issue? Perhaps I'm missing a step? The details of the request I'm making are below:

url = "https://api.sandbox.push.apple.com:443/3/device/{deviceToken}"
headers = {
    "authorization": "Bearer {jwt}",
    "apns-push-type": "alert",
    "apns-topic": bundleId,
    "apns-priority": 10
}
body = {
    "aps": {
        "alert": {
            "title": "Test Notification",
            "body": "This is a test notification.",
            "sound": "default"
        }
    }
}
Answered by Engineer in 797957022

To make sure I understand the situation:

  • using the supabase edge function you send notifications without errors, but they don't arrive
  • using the dashboard you successfully send notifications, and they arrive (?)
  • FCM is working - what does that mean? FCM can send notifications and they arrive?

If the problem is only with the supabase edge function, with no errors but no arriving notifications, then it is likely that the issue with something on that end.

Perhaps the actual request headers/payload are malformed when created by the application.

Another possibility is that the token you are using is not the active token for that app at that time. We see this happen a lot during development where during debugging new builds are installed over and over on the same device, sometimes over the old version, sometimes by deleting first, and the token may have changed. So, also make sure you are using the correct token for the current instance of the app at the time.

We have a pinned post on how to provide diagnostic information so we can check what might be the problem. Please read through the post If you need assistance debugging your push notification issues

and supply the requested detailed information for a notification request that was not received and we can take a look


Argun Tekant /  DTS Engineer / Core Technologies

Accepted Answer

To make sure I understand the situation:

  • using the supabase edge function you send notifications without errors, but they don't arrive
  • using the dashboard you successfully send notifications, and they arrive (?)
  • FCM is working - what does that mean? FCM can send notifications and they arrive?

If the problem is only with the supabase edge function, with no errors but no arriving notifications, then it is likely that the issue with something on that end.

Perhaps the actual request headers/payload are malformed when created by the application.

Another possibility is that the token you are using is not the active token for that app at that time. We see this happen a lot during development where during debugging new builds are installed over and over on the same device, sometimes over the old version, sometimes by deleting first, and the token may have changed. So, also make sure you are using the correct token for the current instance of the app at the time.

We have a pinned post on how to provide diagnostic information so we can check what might be the problem. Please read through the post If you need assistance debugging your push notification issues

and supply the requested detailed information for a notification request that was not received and we can take a look


Argun Tekant /  DTS Engineer / Core Technologies

APNS push is not received by device when sent via backend despite 200 OK response received
 
 
Q