[expo-notifications] DeviceNotRegistered: The recipient device is not registered with FCM.

See original GitHub issue

šŸ› Bug Report

Summary of Issue

token = (await Notifications.getExpoPushTokenAsync({ experienceId: experienceId })).data; retrieves invalid push tokens Here are some:

ExponentPushToken[0J23tlOl6Qz92gG9SM4ceI] ExponentPushToken[qcL4EiLB_aTct8VdVsXFfu] ExponentPushToken[D5PQ0qDWvvDqoomMg8I2G8]

Environment - output of expo diagnostics & the platform(s) you’re targeting

Bare workflow

  Expo CLI 3.22.3 environment info:
    System:
      OS: Windows 10 10.0.18362
    Binaries:
      Node: 14.4.0 - C:\Program Files\nodejs\node.EXE
      Yarn: 1.22.4 - C:\Users\Myself\AppData\Roaming\npm\yarn.CMD
      npm: 6.14.4 - C:\Program Files\nodejs\npm.CMD
    npmPackages:
      expo: ^38.0.8 => 38.0.8
      react: ~16.11.0 => 16.11.0
      react-dom: ~16.11.0 => 16.11.0
      react-native: ~0.62.2 => 0.62.2
      react-native-web: ~0.11.7 => 0.11.7

Reproducible Demo

https://expo.io/notifications

Steps to Reproduce

retrieved token with token = (await Notifications.getExpoPushTokenAsync({ experienceId: experienceId })).data;

https://exp.host/--/api/v2/push/send
POST
{
    "to": "ExponentPushToken[qcL4EiLB_aTct8VdVsXFfu]",
    "sound": "default",
    "title": "Test",
    "body": "Test",
    "data": { "data": "goes here" }
  }

Expected Behavior vs Actual Behavior

{
    "data": {
        "id": "20ede6dd-95d8-484d-96aa-3560c21031a3",
        "status": "error",
        "message": "The recipient device is not registered with FCM.",
        "details": {
            "error": "DeviceNotRegistered",
            "fault": "developer"
        }
    }
}

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:24 (10 by maintainers)

github_iconTop GitHub Comments

4reactions
brunoaduartecommented, Aug 6, 2020

I’m not really sure what exactly is causing this issue, but we aren’t seeing any abnormalities with FCM notifications from our end. Expo is simply forwarding along this error message from FCM- it’s the Unregistered device error listed here: https://firebase.google.com/docs/cloud-messaging/http-server-ref

This looks like a similar issue to this one, so just double-check your steps match those

I’ve followed all those steps… otherwise it would not work at all… šŸ¤·ā€ā™‚ļø BTW, i’m running these latest tests on LDPLayer. Can that be the problem?

2reactions
cruzachcommented, Sep 24, 2020

Deleting the app and reinstalling it will generate a new Expo push token

As I’ve stated above, Expo is simply forwarding this error message along from FCM. We’ve had this error message posted a few times, and it’s always been a configuration issue, or the device’s token is no longer valid (app hasn’t been opened in a while or the user revoked notification permissions).

Here’s a great list of common mistakes when setting up FCM notifications in Expo.

Google’s documentation is very clear that if you receive this message, you should stop sending notifications to the app:

An existing registration token may cease to be valid in a number of scenarios, including:

  • If the client app unregisters with FCM.If the client app is automatically unregistered, which can happen if the user uninstalls the application. For example, on iOS, if the APNs Feedback Service reported the APNs token as invalid.
  • If the registration token expires (for example, Google might decide to refresh registration tokens, or the APNs token has expired for iOS devices).
  • If the client app is updated but the new version is not configured to receive messages.

For all these cases, remove this registration token from the app server and stop using it to send messages.

Read more comments on GitHub >

github_iconTop Results From Across the Web

expo-notifications DeviceNotRegistered error : r/reactnative
"ExponentPushToken[]" is not a registered push notification recipient". It's possible that you're not sending any token to expo.
Read more >
Sending Notifications with Expo's Push API
The DeviceNotRegistered error appears in push receipts only when Apple, Google, or another push notification provider deems the device to be unregistered;Ā ...
Read more >
The recipient device is not registered with FCM - Stack Overflow
The registration token you are trying to send a notification to is registered to another Firebase project. Please make sure that the app...
Read more >
Basics and caveats of Expo-notifications - DEV Community ā€ ā€
... the message to the recipient devices. Be aware that expo-notifications does not work on emulators, so you should tested on real devices....
Read more >
Best practices for FCM registration token management
Retrieve and store registration tokens; Detect invalid token responses from the ... sometimes the FCM backend cannot verify whether or not a device...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found