【发布时间】:2019-08-18 15:43:48
【问题描述】:
我正在测试一些 Firebase Cloud 功能,当我使用 firebase functions:shell 在本地测试它们时,我收到此错误:
@firebase/database: FIREBASE WARNING: {"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: getaddrinfo ENOTFOUND
metadata.google.internal metadata.google.internal:80. Error code:
ENOTFOUND\"."}
当我尝试访问函数内部的admin.database() 时似乎会发生这种情况。
这些是我正在使用的 npm 模块:
"dependencies": {
"firebase-admin": "^8.0.0",
"firebase-functions": "^3.1.0",
},
这里有什么我遗漏的吗?我试过卸载firebase-tools 并通过npm i -g firebase-tools 重新安装,但没有帮助。
我也在通过admin.initializeApp() 初始化应用程序
【问题讨论】:
-
您解决了吗?我也有同样的问题...谢谢!
标签: firebase google-cloud-functions firebase-tools