【发布时间】:2021-12-11 04:25:55
【问题描述】:
我正在构建 NodeJs 服务器并尝试利用 FCM 进行推送通知。本地一切正常,但在 K8S 集群中我收到以下错误
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: Missing error payload".
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: Missing error payload".'
},
codePrefix: 'app'
我尝试在没有参数 admin.initializeApp() 的情况下初始化应用程序,将 env var 与路径 json 键保存在配置对象中,路径有效,文件存在,env 打印正常。
我试过这样const firebase = admin.initializeApp({ credential: admin.credential.applicationDefault(), });,这显然是同一件事。我尝试使用 json 证书显式传递凭证道具,例如 const firebase = initializeApp({ credential: admin.credential.cert(cert) });
证书存在。我什至尝试将 firebase-admin 从 10 降级到 9。
节点 12
请帮忙
【问题讨论】:
标签: node.js firebase kubernetes firebase-cloud-messaging