0

I am trying to deploy my Firebase Cloud Functions using firebase deploy --only functions. My functions do get successfully deployed, but I get this warning message in the console:

@firebase/database: FIREBASE WARNING: {"code":"app/invalid-credential","message":"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: Error while making request: getaddrinfo ENOTFOUND metadata.google.internal. Error code: ENOTFOUND"."}

This is what I have at the top of my index.ts:

import * as functions from "firebase-functions";
import * as admin from "firebase-admin";

admin.initializeApp({
    credential: admin.credential.applicationDefault(),
    databaseURL: "https://<DATABASE_NAME>.firebaseio.com",
});

I have done export GOOGLE_APPLICATION_CREDENTIALS="/path/to/service-account-file.json".

How do I get rid of this warning message?

Tom Darious
  • 434
  • 6
  • 18
  • Does this answer your question? [Error fetching access token: Error while making request: getaddrinfo ENOTFOUND metadata.google.internal. ERROR HAPPENS SOMETIMES?](https://stackoverflow.com/questions/70357871/error-fetching-access-token-error-while-making-request-getaddrinfo-enotfound-m) – Marc Anthony B Jul 04 '22 at 02:14
  • @MarcAnthonyB I never used a Firebase Config. The answer from that post is honestly confusing. – Tom Darious Jul 04 '22 at 03:36
  • Have you tried to initialize a new Firebase project and see if it still occurs? I haven't been able to reproduce the issue that you're encountering. If the problem still persist after initializing a new project then I would suggest to post an issue on the [firebase-tools](https://stackoverflow.com/questions/58311629/firebase-cloud-functions-app-invalid-credential-failed-to-fetch-a-valid-google#:~:text=github.com/firebase/firebase%2Dtools) GitHub with full steps that reproduce the problem, and be sure your CLI is fully up to date. – Marc Anthony B Jul 05 '22 at 00:12
  • Also, I would suggest contacting [Firebase Support](https://firebase.google.com/support/troubleshooter/contact) to further help you with your problem. – Marc Anthony B Jul 05 '22 at 00:12
  • Also having this issue. Possible duplicate of [Firebase v.11.1.0 CLI - OAUTH2 warning in command prompt](https://stackoverflow.com/questions/72762970/firebase-v-11-1-0-cli-oauth2-warning-in-command-prompt) – Ben Long Sep 30 '22 at 18:16

0 Answers0