question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItĀ collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Please set your project ID. A valid Firebase project ID is required

See original GitHub issue

šŸ› Bug Report

Summary of Issue

Hello everyone, I’m getting this error only on Android production app.

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

Expo CLI 3.27.13 environment info: System: OS: macOS 10.15.7 Shell: 5.7.1 - /bin/zsh Binaries: Node: 12.16.3 - ~/.nvm/versions/node/v12.16.3/bin/node Yarn: 1.22.4 - ~/.nvm/versions/node/v12.16.3/bin/yarn npm: 6.14.4 - ~/.nvm/versions/node/v12.16.3/bin/npm Watchman: 4.9.0 - /usr/local/bin/watchman Managers: CocoaPods: 1.9.3 - /usr/local/bin/pod SDKs: iOS SDK: Platforms: iOS 14.0, DriverKit 19.0, macOS 10.15, tvOS 14.0, watchOS 7.0 Android SDK: API Levels: 27, 29 Build Tools: 28.0.3, 29.0.0 System Images: android-27 | Google Play Intel x86 Atom, android-28 | Google Play Intel x86 Atom, android-R | Google APIs Intel x86 Atom IDEs: Android Studio: 3.6 AI-192.7142.36.36.6308749 Xcode: 12.0.1/12A7300 - /usr/bin/xcodebuild npmPackages: expo: ~39.0.3 => 39.0.3 react: 16.13.1 => 16.13.1 react-native: https://github.com/expo/react-native/archive/sdk-39.0.3.tar.gz => 0.63.2 Expo Workflow: managed

Reproducible Demo

`

Unable to provide. It only happens on production App.

Steps to Reproduce

Expected Behavior vs Actual Behavior

I’m expecting to get the token, but the call for get it throws error:

Schermata 2020-10-07 alle 10 51 33

This is the function that should return the token, but Notifications.getExpoPushTokenAsync() throw error.

The error is šŸ‘

Encountered an exception while calling native method: Exception occurred while executing exported method getDevicePushTokenAsync on module ExpoPushTokenManager: Please set your project ID. A valid Firebase project ID is required to communicate with Firebase server APIs: it identifies your project with google.

I’m not using Firebase. So i have no idea where to take this ID.

I thought that the params in the getExpoPushTokenAsync() function, were optional.

The weird is that if i run the App through the command Expo start, in dev. the function correctly returns the token.

How to solve this ?

Thanks in advance

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
byCedriccommented, Oct 8, 2020

The Firebase project and your app identifier don’t need to match, do you have a link to the docs where it says that? You still have to set a package identifier in your Firebase project when connecting it to Android app or push notifications. But that should be pretty straight forward and relevant only when asked.

I’m going to close this now because I don’t think this is a bug or an issue with the notifications. If you still have questions about this, feel free to ask them on Slack or the forums.

Hope this helps!

0reactions
vinaciotmcommented, Aug 4, 2022

set your api key on expo

  1. At the top of the sidebar, click the gear icon to the right of Project Overview to go to your project settings.
  2. Click on the Cloud Messaging tab in the Settings pane.
  3. Copy the token listed next to Server key.
  4. Run expo push:android:upload --api-key <your-token-here>, replacing <your-token-here> with the string you just copied. We’ll store your token securely on our servers, where it will only be accessed when you send a push notification.

if you have new token function

function* getNewToken() {
  if (Platform.OS === "android")
    ExpoNotifications.setNotificationChannelAsync("default", {
      name: "default",
      importance: ExpoNotifications.AndroidImportance.MAX,
      vibrationPattern: [0, 250, 250, 250],
      lightColor: THEME.default.colors.danger,
    });

  const res = yield ExpoNotifications.getExpoPushTokenAsync();
  const token = res?.data;
  if (!token) throw { ui_message: "NĆ£o foi possĆ­vel obter o token de push" };
  return token;
}

set config of ios and android on root project

  1. go to firebase
  2. find your app and download google-services.json for android
  3. find your app and download GoogleService-Info.plist for ios
  4. insert both downloaded file in your root project
Read more comments on GitHub >

github_iconTop Results From Across the Web

Expo: cannot get getDevicePushTokenAsync due to non-valid ...
A valid Firebase project ID is required to communicate with Firebase server APIs: It identifies your project with Google." I guess it hasĀ ......
Read more >
Understand Firebase projects - Google
Using the Firebase console: Click settings Project settings. The project ID is displayed in the top pane. Using the Firebase CLI: Run firebase...
Read more >
Firebase Invalid Project ID (SOLVED) | B4X Programming Forum
A valid Firebase project ID is required to communicate with Firebase server APIs: It identifies your project with Google. The error is caused...
Read more >
Using Firebase - Expo Documentation
The config object requires an API key and other unique identifiers. To obtain these values, you will have to register a web app...
Read more >
Troubleshooting Android - WonderPush documentation
If you see one of the following errors: java.lang.IllegalArgumentException: Please set your project ID. A valid Firebase project ID is required to communicateĀ ......
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