Functions-samples: deploying functions - FIREBASE WARNING: app/invalid-credential

Created on 20 Mar 2017  Â·  4Comments  Â·  Source: firebase/functions-samples

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?

Most helpful comment

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."}

All 4 comments

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.

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 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.

are you behind a firewall or proxy?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

phuduong060196 picture phuduong060196  Â·  4Comments

artcab picture artcab  Â·  4Comments

Rovel picture Rovel  Â·  5Comments

palimad picture palimad  Â·  3Comments

aaronte picture aaronte  Â·  6Comments