Credential implementation provided to initializeApp() via the "credential" property failed to fetch a valid Google OAuth2

Viewed 2421

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?

3 Answers

This looks like a problem with NodeJS, the version 8 is no longer supported as per the documentation. Deployment of functions to the Node.js 8 runtime was disabled in the Firebase CLI on December 15, 2020 and that is most likely why you are facing the 404 error.

To migrate to a newer supported version of the NodeJS runtime, use the documentation.

Also, I do not suspect any issue with your firebase-admin version 7.3.0.

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();
Related