简体   繁体   English

部署firebase函数时为什么会报错?

[英]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.

相关问题 在 Firebase 中部署函数时出错 - Getting error when deploying functions in Firebase Firebase - 错误:部署函数时出错 - Firebase - Error: There was an error deploying functions 部署功能时的Firebase SyntaxError - Firebase SyntaxError when deploying functions 在Firebase功能上部署Braintree服务器时发生意外错误 - Unexpected Error when deploying braintree server on firebase functions 为什么只有在部署到 Firebase 时才会在 Node.js 和 Angular 之间出现 CORS 错误? - Why do I get a CORS error between Node.js and Angular only when deployed to Firebase? 部署 firebase 项目时出现错误显示“找不到模块 firebase-functions” - Error shows 'cannot find module firebase-functions' when deploying a firebase project Firebase 云功能:部署 function 时出错 - Firebase Cloud Functions: Error while deploying function Firebase 部署函数时出现部署错误 - Firebase Deploy Error while deploying functions 在 Firebase 中部署函数时出现未找到 Firebase 错误 - Getting Firebase not found error while deploying functions in firebase 当我尝试初始化 firebase 应用程序时,为什么 Google Cloud Functions 会抛出“配置 firebase.databaseURL 的无效值”错误? - Why is Google Cloud Functions throwing a "Invalid value for config firebase.databaseURL" error when I try to initialize a firebase app?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM