'Credential implementation provided to initializeApp() via the "credential" property failed to fetch a valid Google OAuth2
I have a NodeJS Firebase Function that uses firebase-admin sdk. It has been working alright since last year. In the last 2 weeks, the following error started showing in the log:
Credential implementation provided to initializeApp() via the "credential" property failed to fetch a valid Google OAuth2 access token with the following error: "Error fetching access token: 404 page not found
Could it be an issue with the version of "firebase-admin": "^7.3.0" I am using?
Have anyone faced the same issue and can you offer some direction on what might have been the cause?
Solution 1:[1]
I have the same error, but I was already on Node 12. Also, the function was running well for years and now is crashing due to this :/
The only solution that worked for me was to change auth to admin from default to explicit passing of service-account.json like is described here in docs https://firebase.google.com/docs/reference/admin/node/admin.credential#cert
Solution 2:[2]
For those who are deploying to Google Cloud Functions, requirements:
- Node >= 10
Initialisation:
const functions = require('firebase-functions');
const admin = require('firebase-admin');
admin.initializeApp();
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Dharman |
| Solution 2 | Yash |
