javascript - 什么原因无法加载默认凭据错误?
问题描述
我正在关注本教程。
我部署了这个云功能firebase serve
:
exports.createScream = functions.https.onRequest((req, res) => {
const newScream = {
body: req.body.body,
userHandle: req.body.userHandle,
createdAt: admin.firestore.Timestamp.fromDate(new Date())
};
admin
.firestore()
.collection('screams')
.add(newScream)
.then((doc) => {
res.json({ message: `document ${doc.id} created sucseccfully` });
})
.catch((err) => {
res.status(500).json({ error: err });
console.error(err);
});
});
我收到此错误:
functions: Beginning execution of "createScream"
Error: Could not load the default credentials. Browse to https://cloud.google.com/docs/authentication/getting-started for more information.
at GoogleAuth.getApplicationDefaultAsync (C:\Users\Örs\Desktop\social-app\screem-app_functions\functions\node_modules\google-auth-library\build\src\auth\googleauth.js:161:19)
at process._tickCallback (internal/process/next_tick.js:68:7)
i functions: Finished "createScream" in ~1s
我搞砸了什么?我如何解决它?谢谢你的时间。
解决方案
推荐阅读
- javascript - React Hooks:Transition 不适用于 Node 作为 Prop
- java - hibernate 5.4.12.Final“注解类型NamedQuery的属性cacheable未定义”,不支持cacheable = true吗?
- python - 如何舍入预测
- amazon-web-services - 运行权限命令 AWS 后给出 503 错误
- python - Google Colab 从 Kaggle 导入数据库
- bash - 如何从基因列表中选择多个 fasta 序列
- javascript - 如何在反应后方法调用中传递带有表示数字数据类型的值的json属性
- activemq - 主题的 ActiveMQ 单次出列
- c - Archive has no index; run ranlib to add one (when linking with a .a containing a MachO64 object file on Linux)
- python - 如何使用Python返回整数列表的所有子集的列表?