【发布时间】:2019-05-09 11:10:16
【问题描述】:
我有一个 firebase 云函数,它从云 firestore 获取数据。
const userSnapshot = await admin.firestore().collection('users').doc(user).get()
当此 api 使用 firebase emulators:start 在本地部署时。
我收到以下错误:
The Cloud Firestore emulator is not running so database operations will fail with a 'default credentials' error.
⚠ Google API requested!
- URL: "https://oauth2.googleapis.com/token"
- Be careful, this may be a production service.
> Auth error:Error: invalid_grant
只有在更新 firebase-tools 后才会发生这种情况。
以前使用firebase serve --only function --port=9000 可以正常工作。
在这个工具版本中,我无法通过命令行设置端口。
【问题讨论】:
-
请在 Firebase 模拟器 GitHub 上发布您的问题。 github.com/firebase/firebase-tools
-
嗨!你能确保你正在运行
firebase-tools@6.9.1,这是6.9.0中的一个已知问题 -
现在是6.9.1版本但还是存在错误
-
在一个错误中,他们要求从 ~/.config/gcloud 中删除 application_default_credential.json。之后,我收到此错误:Cloud Firestore 模拟器未运行,因此数据库操作将失败并出现“默认凭据”错误。 ⚠ 已请求 Google API! - URL:“oauth2.googleapis.com/token” - 小心,这可能是生产服务。 > 错误:16 UNAUTHENTICATED:请求具有无效的身份验证凭据。预期的 OAuth 2 访问令牌、登录 cookie 或其他有效的身份验证凭据。见developers.google.com/identity/sign-in/web/devconsole-project。
标签: firebase google-cloud-firestore firebase-admin firebase-cli