Cloud functions suddenly producing error of "Getting metadata from plugin failed with error:" & "Could not refresh access token"

2,801 views
Skip to first unread message

Jon Mountjoy

unread,
Jan 31, 2018, 7:30:04 PM1/31/18
to Firebase Google Group
I have a cloud function that does nothing with access tokens or authentication.  I don't believe I've changed the cloud function in any meaningful way, it was working 30 minutes ago.  Now it produces an exception.

Error getting document: { Error: 16 UNAUTHENTICATED: Getting metadata from plugin failed with error: Could not refresh access token.
    at createStatusError (/user_code/node_modules/firebase-admin/node_modules/grpc/src/client.js:65:15)
    at ClientReadableStream._emitStatusIfDone (/user_code/node_modules/firebase-admin/node_modules/grpc/src/client.js:271:19)
    at ClientReadableStream._receiveStatus (/user_code/node_modules/firebase-admin/node_modules/grpc/src/client.js:249:8)
    at /user_code/node_modules/firebase-admin/node_modules/grpc/src/client.js:715:12
  code: 16,
  metadata: Metadata { _internal_repr: {} },
  details: 'Getting metadata from plugin failed with error: Could not refresh access token.' }

The full function (forgive my bad Node) is below.

I haven't changed any security settings either, between the time it worked and stopped working.

Any thoughts?

Jon


'use strict';

const functions = require('firebase-functions');

exports.decrementLikeCountOnSighting =
functions.firestore.document('users/{userid}/sightings/{sightingid}/likes/{likeID}').onDelete(event => {
console.log("decrementLikeCountOnSighting")
var deletedValue = event.data.previous.data;

const sightingRef = event.data.ref.parent.parent

return sightingRef.get().then((doc) => {
console.log("In sub thingie")
if (doc.exists) {
var sighting = doc.data();
var newNumberOf = sighting.numberOfLikes - 1
console.log("Number of likes = ", sighting.numberOfLikes)
return sightingRef.set({
numberOfLikes: newNumberOf
}, {merge:true})
} else {
// doc.data() will be undefined in this case
console.log("No such document!");
}
return true
}).catch((error) => {
console.log("Error getting document:", error);
return false
});
})



Badger

unread,
Feb 1, 2018, 10:38:06 AM2/1/18
to Firebase Google Group
We've been experiencing the same thing. A redeploy go the function seemed to fix it. Potentially linked to: https://status.firebase.google.com/incident/Functions/18011

More widely we've been having problems with anything loading. There must be another issue that they haven't reported yet.

Sebastian Schmidt

unread,
Feb 1, 2018, 1:36:07 PM2/1/18
to Firebase Google Group
Hello,
thanks for reporting this issue. We deployed a new version of google-gax that addresses this issue (0.14.5 as per https://www.npmjs.com/package/google-gax). If you redeploy your function, GCF will automatically pull in this patch release.

Please let us know if this issue is not resolved.

Sorry for the inconvenience,
Sebastian
Reply all
Reply to author
Forward
0 new messages