When trying to deploy the template function after initialising firebase functions, I keep getting: HTTP Error: 400, The request has errors. 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. Change it to this: exports.helloWorld =...
. Furthermore, this had been a recurrent issue in the past by attempting to use older versions of the Firebase CLI. Try updating it by running npm i -g firebase-tools@latest
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.