I am testing some Firebase Cloud functions and when I test them locally using firebase functions:shell
, I get this error:
@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 metadata.google.internal:80. Error code:
ENOTFOUND\"."}
It seems to happen when I try to access admin.database()
inside of the function.
These are my npm modules I'm using:
"dependencies": {
"firebase-admin": "^8.0.0",
"firebase-functions": "^3.1.0",
},
Is there something I'm missing here? I've tried uninstalling firebase-tools
and reinstalling via npm i -g firebase-tools
and that didn't help.
I'm also initializing the app via admin.initializeApp()