Firebase Cloud消息:app/invalid-credential -未能获取有效的Google OAuth



我一直面临着同样的问题随机即这个问题发生的时候,而工作良好的大部分时间。运行nodejs版本14。

Error sending message: FirebaseAppError: 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: Error while making request: connect ETIMEDOUT ".
at /opt/nodejs/node_modules/firebase-admin/lib/app/firebase-app.js:85:19
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at async fetchVideosAndUsers (/var/task/src/videos-notifications.js:180:17)
at async doAction (/var/task/src/videos-notifications.js:233:30)
at async Runtime.exports.handler (/var/task/src/) {
errorInfo: {
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: Error while making request: connect ETIMEDOUT".'
},
codePrefix: 'app'
}

请建议。

此错误可能是由应用程序的凭据问题引起的。您可以尝试检查以下内容:

  • 确保你请求的是作用域:https://www.googleapis.com/auth/firebase.messaging,因为你需要这个来授权你的应用访问FCM。
  • 确保您获得了正确的服务帐户。然后生成私钥文件(JSON格式)来授权访问Firebase服务。

最新更新