Firestore更新有时会失败,并显示错误“错误:16未经授权:请求具有无效的身份验证凭据”。

时间:2019-01-11 07:52:21

标签: firebase google-cloud-firestore

我正在使用nodejs(v6.9.4)中的“ firebase-admin”(v6.4.0)npm软件包与Firestore连接(使用服务帐户.json文件)。

一切正常(读取/更新正常工作)但有时我收到了

"Error: 16 UNAUTHENTICATED: Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential."

整个错误-

{ Error: 16 UNAUTHENTICATED: Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.
    at Object.exports.createStatusError (/home/ec2-user/socialhelpouts/deployment/social-helpouts/node_modules/google-gax/node_modules/grpc/src/common.js:87:15)
    at Object.onReceiveStatus (/home/ec2-user/socialhelpouts/deployment/social-helpouts/node_modules/google-gax/node_modules/grpc/src/client_interceptors.js:1214:28)
    at InterceptingListener._callNext (/home/ec2-user/socialhelpouts/deployment/social-helpouts/node_modules/google-gax/node_modules/grpc/src/client_interceptors.js:590:42)
    at InterceptingListener.onReceiveStatus (/home/ec2-user/socialhelpouts/deployment/social-helpouts/node_modules/google-gax/node_modules/grpc/src/client_interceptors.js:640:8)
    at callback (/home/ec2-user/socialhelpouts/deployment/social-helpouts/node_modules/google-gax/node_modules/grpc/src/client_interceptors.js:867:24)
  code: 16,
  metadata: Metadata { _internal_repr: { 'www-authenticate': [Object] } },
  details: 'Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.' }

我已阅读this post并按照云提供商AWS chrony的建议使用here来保持服务器时间同步。 现在时间已同步,但我仍然收到相同的错误。

由于它大部分时间(〜95%)都能正常工作,并且偶尔会失败(使用完全相同的代码),所以我没有可复制的代码。

0 个答案:

没有答案