我正在部署一个google函数,它执行一些服务器计算,并将结果写入同一项目的Firestore DB中。
我遵循how-tos并通过以下方式配置函数
const functions = require('firebase-functions');
const admin = require('firebase-admin');
admin.initializeApp();并使用以下命令访问Firestore数据库:
admin.firestore().collection('COLLECTION_NAME').add({data: value});IAM用户...@gcf-admin-robot.iam.gserviceaccount.com具有分配的Google Cloud Functions Service Agent角色。
我得到以下错误:
Error: 500 undefined: Getting metadata from plugin failed with error: Could not refresh access token: Unsuccessful response status code. Request failed with status code 500
at Object.callErrorFromStatus (/workspace/node_modules/@grpc/grpc-js/build/src/call.js:30:26)
at Object.onReceiveStatus (/workspace/node_modules/@grpc/grpc-js/build/src/client.js:175:52)
at Object.onReceiveStatus (/workspace/node_modules/@grpc/grpc-js/build/src/client-interceptors.js:341:141)
at Object.onReceiveStatus (/workspace/node_modules/@grpc/grpc-js/build/src/client-interceptors.js:304:181)
at Http2CallStream.outputStatus (/workspace/node_modules/@grpc/grpc-js/build/src/call-stream.js:116:74)
at Http2CallStream.maybeOutputStatus (/workspace/node_modules/@grpc/grpc-js/build/src/call-stream.js:155:22)
at Http2CallStream.endCall (/workspace/node_modules/@grpc/grpc-js/build/src/call-stream.js:141:18)
at Http2CallStream.cancelWithStatus (/workspace/node_modules/@grpc/grpc-js/build/src/call-stream.js:457:14)
at callStream.filterStack.sendMetadata.then (/workspace/node_modules/@grpc/grpc-js/build/src/channel.js:225:36)
at process._tickCallback (internal/process/next_tick.js:68:7)
Caused by: Error
at WriteBatch.commit (/workspace/node_modules/@google-cloud/firestore/build/src/write-batch.js:415:23)
at DocumentReference.create (/workspace/node_modules/@google-cloud/firestore/build/src/reference.js:283:14)
at CollectionReference.add (/workspace/node_modules/@google-cloud/firestore/build/src/reference.js:2011:28)
at exports.parseProduct.functions.region.https.onRequest (/workspace/index.js:55:56)
at process._tickCallback (internal/process/next_tick.js:68:7)
code: '500',
details:
'Getting metadata from plugin failed with error: Could not refresh access token: Unsuccessful response status code. Request failed with status
metadata: Metadata { internalRepr: Map {}, options: {} },
note:
'Exception occurred in retry method that was not classified as transient'我做错了什么?
发布于 2020-08-12 02:52:05
对于任何看到上述错误消息的人。它连接(至少在这种情况下)到服务帐户的权限。我正在调整一些权限,并停用了一些我认为不需要的帐户。
其中之一是“项目名称”@appspot.gserviceaccount.com重新激活它解决了我的问题。
如果Google能在这种情况下显示更多有意义的错误消息,那就太好了!
发布于 2020-08-12 01:54:56
这似乎是一个内部问题,而不是你正在做的事情。通过快速搜索,我在GitHub和SO中发现了一个非常类似的问题。从这些链接中,我注意到它更多的是关于一个库,我建议联系Firebase Support,因为他们可以检查环境的内部,因为在幕后可能会发生一些奇怪的魔法。
https://stackoverflow.com/questions/63360233
复制相似问题