functions-samples icon indicating copy to clipboard operation
functions-samples copied to clipboard

deploying functions - FIREBASE WARNING: app/invalid-credential

Open tsaarikivi opened this issue 9 years ago • 4 comments

This is the error

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: "read ECONNRESET"."}

How to fix?

tsaarikivi avatar Mar 20 '17 21:03 tsaarikivi

Try upgrading your firebase-tools lib to the latest version, then call firebase logout followed by firebase login. If that doesn't help, reach out via our support/community channels.

katowulf avatar Mar 20 '17 21:03 katowulf

When I am trying to deploy functions locally

Using

firebase serve --only functions

I am getting following error. My PC's (MC) time is proper i.e I have set automatic date&time

✔ functions: helloWorld: http://localhost:5000/pingbuds-268a1/us-central1/helloWorld ✔ functions: getFaceBookUserData: http://localhost:5000/pingbuds-268a1/us-central1/getFaceBookUserData info: User function triggered, starting execution info:

getFaceBookUserData req.body = { facebookIdArray: ' ["102062727235361","12345678"]' } error: 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: invalid_grant (Token has been expired or revoked.)". There are two likely causes: (1) your server time is not properly synced or (2) your certificate key file has been revoked. To solve (1), re-sync the time on your server. To solve (2), make sure the key ID for your key file is still present at https://console.firebase.google.com/iam-admin/serviceaccounts/project. If not, generate a new key file at https://console.firebase.google.com/project/_/settings/serviceaccounts/adminsdk."}

chiragpurohit71085 avatar Nov 13 '17 19:11 chiragpurohit71085

@chiragpurohit71085 I had the same error message when running firebase experimental:functions:shell

I "solved" the issue by updating

npm install -g firebase-tools@latest npm install --save firebase-functions@latest firebase-admin@latest firebase@latest

BUT: It seems that all write operations on the real time database are not executed. The function returns after a while with a timeout.

E.g.:

` import { database as dbEvent } from "firebase-functions";

export default dbEvent.ref("/tariffs/removeHistory").onCreate((event: any) => { const bikesHistoryRef = event.data.adminRef.parent.parent.child("bikesHistory"); return bikesHistoryRef.set(null); });

`

Set never gets executed and function hangs until it runs into a timeout.

Strange thing is that it used to work before. This is why I have been trying with different firebase and node versions.

chris08002 avatar Dec 24 '17 14:12 chris08002

are you behind a firewall or proxy?

goelmk avatar Nov 02 '18 06:11 goelmk