We have a Google Compute Engine that is used to execute nodejs scripts, where one of them connects to Firebase Realtime Database. When this script attempts to connect to RTD it fails with the following:
@firebase/database: FIREBASE WARNING: Provided authentication credentials for the app named "[DEFAULT]" are invalid. This usually indicates your app was not initialized correctly. Make sure the "credential" property provided to initializeApp() is authorized to access the specified "databaseURL" and is from the correct project.
The script connects to an instance that is under the same project. The databaseURL is assigned via the FIREBASE_CONFIG environment variable, and default application credentials are used to authenticate with the various GCP services.
Notes
- Other services such as Firestore and Firebase Auth work without issue: only Realtime Database is a problem.
- The
databaseURLis correct and is used in an App Engine instance that executes without issue. - We have tried passing in the
databaseURLas part of theadmin.initializeApp()config without success.