【发布时间】:2022-01-18 07:05:50
【问题描述】:
首先,这是错误。
Promise { <pending> }
nodejsproject\node_modules\firebase-admin\lib\utils\error.js:44
var _this = _super.call(this, errorInfo.message) || this;
^
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: getaddrinfo ENOTFOUND metadata.google.internal. Error code: ENOTFOUND".
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: getaddrinfo ENOTFOUND metadata.google.internal. Error code: ENOTFOUND".'
},
codePrefix: 'app'
}
据我了解,此错误是因为我的参数无效或导致 firebase 初始化不正确。
现在我正在像这样初始化应用程序:initializeApp();。
所以初始化工作。当我运行诸如const userInfo = await getAuth().verifyIdToken(authorization); 之类的命令时,该命令有效并且我得到了userInfo,但是当我运行诸如const userInfo = await getAuth().getUser(uuid); 之类的命令时它失败了。
据我所知,语法是正确的,我使用这些方法的方式也是正确的。我只是不确定为什么在使用一种方法而不是另一种方法时出现 initializeApp 错误。
【问题讨论】:
标签: javascript typescript firebase firebase-authentication