Firebase 模拟器突然不进行身份验证

Firebase emulator not authenticating suddenly

我今天打开我们的 firebase 函数代码,像往常一样输入 firebase serve,但是当我调用一个涉及我们实时数据库的 http 函数时,我收到了这样的消息:

@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: invalid_grant (Bad Request)\". There are two likely causes: (1) your server time is not properly synced or (2) your certificate key file has been revoked. To solve (1), re-sync the time on your server. To solve (2), make sure the key ID for your key file is still present at https://console.firebase.google.com/iam-admin/serviceaccounts/project. If not, generate a new key file at https://console.firebase.google.com/project/_/settings/serviceaccounts/adminsdk."}

上次(几周前?)我能够 运行 时没有任何变化,我的系统时间设置为自动时间和时区。我 运行 firebase logoutfirebase login 并且我正在使用无参数 admin.initializeApp();。有什么变化需要我考虑吗?

我通过单击底部的 'create key' 使用了在 @ https://firebase.google.com/docs/functions/local-emulator to generate and set up a key file @ https://console.cloud.google.com/iam-admin/serviceaccounts/details/##################?authuser=0&project=my-project-name 中找到的信息。

下载密钥文件后,我在我的项目目录中使用此命令行进行设置

set GOOGLE_APPLICATION_CREDENTIALS=path\to\key.json

完成后,我就可以 运行 我在本地的预期功能了。

我爱你们所有人。