Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

After deploy Cloud Functions error: Could not refresh access token.

I've been experimenting for a while with Firebase Cloud Functions, today I made a minor change to my index.json file (added a field to a document to be set), after deploying on the Firebase Console > Functions > Logs I've got this weird errors:

Auth error:Error: Could not refresh access token.

and:

Error: 16 UNAUTHENTICATED: Getting metadata from plugin failed with error: Could not refresh access token.
at new createStatusError (/user_code/node_modules/firebase-admin/node_modules/grpc/src/client.js:65:15)
at /user_code/node_modules/firebase-admin/node_modules/grpc/src/client.js:568:15

Here's a list of things I tried but did not work:

  1. revert the change in index.json
  2. deploy every function (made the problem worse, now none of my cloud functions is working)
  3. generate a new keyFilename for @google-cloud/storage
  4. npm update firebase-admin
  5. (rebooting)

The last time I did a firebase deploy successfully was last night. I'm on linux.

Thank you.

like image 660
ran3000 Avatar asked Jan 31 '18 19:01

ran3000


People also ask

Why Cloud function deployment failed?

Cloud Functions deployment can fail if the entry point to your code, that is, the exported function name, is not specified correctly. Your source code must contain an entry point function that has been correctly specified in your deployment, either via Cloud console or Cloud SDK.

What are cloud functions in GCP?

Google Cloud Functions is a serverless execution environment for building and connecting cloud services. With Cloud Functions you write simple, single-purpose functions that are attached to events emitted from your cloud infrastructure and services.


2 Answers

Thanks everyone for the reports, both here and especially also via our tech support channels - these really help.

We believe the issue to have been caused by a problem deep in our Node.js dependency chain, in particular for users of Firestore. We've just released https://www.npmjs.com/package/google-gax 0.14.5 to address the issue. Please:

  • Either wait for the npm caches to pick up the new version, or explicitly request google-gax 0.14.5 in your package.json.
  • Re-deploy your functions.

That should resolve things. If you're still having trouble, please let us know!

like image 104
Robert-Jan Huijsman Avatar answered Oct 31 '22 06:10

Robert-Jan Huijsman


Our current suspicion is that a very nested dependency had a breaking change that didn't follow semver. We're investigating and hope to have a fix soon. When this fix rolls out, you'll only have to redeploy.

like image 40
Thomas Bouldin Avatar answered Oct 31 '22 05:10

Thomas Bouldin