expo: Error: Couldn't get push token for device. Check that your FCM configuration is valid.
🐛 Bug Report
Environment
Expo CLI 3.17.24 environment info:
System:
OS: macOS 10.15.4
Shell: 5.7.1 - /bin/zsh
Binaries:
Node: 10.15.1 - ~/.nvm/versions/node/v10.15.1/bin/node
Yarn: 1.16.0 - /usr/local/bin/yarn
npm: 6.14.4 - ~/.nvm/versions/node/v10.15.1/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
IDEs:
Android Studio: 3.4 AI-183.6156.11.34.5522156
Xcode: 11.4/11E146 - /usr/bin/xcodebuild
npmPackages:
expo: ~37.0.3 => 37.0.7
react: ~16.9.0 => 16.9.0
react-native: https://github.com/expo/react-native/archive/sdk-37.0.1.tar.gz => 0.61.4
npmGlobalPackages:
expo-cli: 3.17.24
Runing expo 2.15.1 on Android device
Steps to Reproduce
Create a fresh app
expo init
Modify App.js content with code in https://docs.expo.io/versions/latest/guides/push-notifications/#example-usage
expo r
Expected Behavior
Get the device token
Actual Behavior
In the Browser debug console I got:
Possible Unhandled Promise Rejection (id: 0):
Error: Couldn't get push token for device. Check that your FCM configuration is valid.
Error: Couldn't get push token for device. Check that your FCM configuration is valid.
for line:
token = await Notifications.getExpoPushTokenAsync();
In the metro console
- node_modules/react-native/Libraries/BatchedBridge/NativeModules.js:99:50 in fn
* http://192.168.1.20:19001/node_modules/expo/AppEntry.bundle?platform=android&dev=true&minify=false&hot=false:123335:45 in Object.getExpoPushTokenAsync
* App.js:13:38 in AppContainer#registerForPushNotificationsAsync
- node_modules/regenerator-runtime/runtime.js:45:39 in tryCatch
- node_modules/regenerator-runtime/runtime.js:274:21 in invoke
Reproducible Demo
This is the exact same code than my local machine
https://snack.expo.io/USwkyxS4i
But in snack it works
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 1
- Comments: 27 (12 by maintainers)
hey @cesarve77 sorry that notifications aren’t working right off the bat for you, locally. Are you signed in? (run
expo whoami
to check that)I can’t reproduce this running the code from that snack locally (running Android 10, pixel, signed in to both Expo Client app and the
expo-cli
)That is correct, sorry that it hasn’t been communicated as well as it should. See more information in CHANGELOG.
If you want to use notifications on Android you’ll need to setup a Firebase project. 🙂
<in grim voice>It’s the only way.</in grim voice>
https://docs.expo.io/push-notifications/using-fcm/#client-setup
I wasn’t logged in on expo. To check that, run
expo whoami
. If you’re not logged in too, just login usingexpo login
.