[英]Why do I get an error when deploying firebase functions?
When trying to deploy the template function after initialising firebase functions, I keep getting: HTTP Error: 400, The request has errors.在初始化 firebase 函数后尝试部署模板 function 时,我不断收到:HTTP 错误:400,请求有错误。 Any ideas on what's going on?关于发生了什么的任何想法?
Here's the relevant code.这是相关的代码。
export const helloWorld = functions.https.onRequest((request, response) => {
response.send("Hello from Firebase!");
});
Firebase does not expect named exports ( export const...
) and instead expects an exports
object containing the function to run. Firebase 不期望命名导出( export const...
),而是期望包含 function 的exports
object 运行。 Change it to this: exports.helloWorld =...
.将其更改为: exports.helloWorld =...
Furthermore, this had been a recurrent issue in the past by attempting to use older versions of the Firebase CLI.此外,在过去尝试使用旧版本的 Firebase CLI 时,这一直是一个反复出现的问题。 Try updating it by running npm i -g firebase-tools@latest
.尝试通过运行npm i -g firebase-tools@latest
来更新它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.