Cloud Functions Deploy Build Failed: function.js Doest Not Exist

Nov 17, 2020
ERROR: (gcloud.functions.deploy) OperationError: code=3, message=Build failed: function.js does not exist; Error ID: 7485c5b6
2020-11-17T04:00:24.347488828Z Step #4 - "builder": === Node.js - Functions Framework ([email protected]) === I 
2020-11-17T04:00:24.347877926Z Step #4 - "builder": Failure: (ID: 7485c5b6) function.js does not exist I 

I run into the above error because I try to deploy a Firebase Cloud Function via gcloud tool (where firebase tool should be used instead).

const functions = require('firebase-functions');exports.hello = functions.https.onRequest((req, res) => {  res.send(`Hello ${req.query.name}`);});

This will produce the error

gcloud functions deploy hello --runtime nodejs10 --trigger-http --allow-unauthenticated

Use this instead

firebase deploy --only functions:hello

Refer Cloud Functions by Firebase vs Cloud Functions.

❤️ Is this article helpful?

Buy me a coffee ☕ or support my work via PayPal to keep this space 🖖 and ad-free.

Do send some 💖 to @d_luaz or share this article.

✨ By Desmond Lua

A dream boy who enjoys making apps, travelling and making youtube videos. Follow me on @d_luaz

👶 Apps I built

Travelopy - discover travel places in Malaysia, Singapore, Taiwan, Japan.