我正在关注this教程。
我已使用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
我搞砸了什么?我如何解决它?感谢您的宝贵时间。