Open p8952 opened 1 year ago
I found a few problems with this issue:
I seem to be suffering from the same issue. The newest docs show that GOOGLE_APPLICATION_CREDENTIALS should be "/path/to/json-file/firebase-adminsdk-xxx-xxx.json" and that the following should work to connect to the admin SDK:
const { initializeApp, applicationDefault } = require("firebase-admin/app");
initializeApp({
credential: applicationDefault(),
projectId: process.env.GCLOUD_PROJECT,
databaseURL: process.env.REALTIME_DB_URL
});
But this gives the error:
Error: Failed to read credentials from file /path/to/json-file/firebase-adminsdk-xxx-xxx.json: Error: ENOENT: no such file or directory, open '/path/to/json-file/firebase-adminsdk-xxx-xxx.json,'
I've worked around for now by doing this instead:
const admin = require("firebase-admin");
const creds = require("../firebase-adminsdk-xxx-xxx.json");
admin.initializeApp({
credential: admin.credential.cert(creds),
projectId: process.env.GCLOUD_PROJECT,
databaseURL:
process.env.REALTIME_DB_URL
});
Not ideal as a relative path needs hard-coding, but it's working.
+1
+1
Hey folks, are you all having this issue on Node.js Version: v16.19.1
? We did not make any recent changes to the credentials handling logic so I wonder if some change in Node.js file path resolutions caused this issue. Please share your Node.js version and Admin SDK version if you are experiencing the same problem.
Node.js v 16.18.0 firebase-tools v 11.28.0 Project issue located here https://github.com/WindMillCode/firebase_deploy_issue
any update for our use case?
~/projects/1/code/code main firebase --version
13.1.0
~/projects/1/code/code main node -v
v18.19.0
~/projects/1/code/code main
Every goddam time I bump into any task related to Firebase it's the same thing, misleading documentation with no solutions on the web and GitHub issues where the community has been ignored for more than 1 year. Ultra annoying.
Every goddam time I bump into any task related to Firebase it's the same thing, misleading documentation with no solutions on the web and GitHub issues where the community has been ignored for more than 1 year. Ultra annoying.
+1
Environment
Description
We're unable to authenticate using the GOOGLE_APPLICATION_CREDENTIALS environment variable, which worked previously.
This is possibly related to this depreciation, as I believe the last time we were able to successfully authenticate was prior to March 31st 2023.
The issue seems to not be limited to firebase-admin-node, as people are seeing the same error with firebase-tools.
Example Code
Error:
(The error persists even when generating a new private key, so I don't believe the error message stating ACCESS_TOKEN_EXPIRED is accurate)