首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Firebase函数- admin.firestore() get()在本地服务上抛出身份验证错误

问Firebase函数- admin.firestore() get()在本地服务上抛出身份验证错误
EN

Stack Overflow用户
提问于 2019-05-09 19:10:17
回答 1查看 2.1K关注 0票数 5

我有一个firebase云函数,它从云存储中获取数据。

代码语言:javascript
复制
const userSnapshot = await admin.firestore().collection('users').doc(user).get()

使用firebase emulators:start在本地部署此接口时。

我得到以下错误:

代码语言:javascript
复制
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时工作得很好。在这个工具版本中,我不能通过命令行设置端口。

EN

回答 1

Stack Overflow用户

发布于 2019-05-11 12:30:52

在6.9.2中解决了这个问题

我们可以使用带端口号的firebase服务来访问firestore。

https://github.com/firebase/firebase-tools/issues/1265

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/56058087

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档