2

I have a problem that when I deploy JavaScript Cloud Function, it says deploy completed, but when I go to Firebase and check it is just not there. Strange thing is that for TypeScript Cloud Function it works properly.

I did everything the whole preparation like installing firebase-tools etc. by original Firebase video tutorial. I tried to deploy only uncommented hello world function but same results.

I also tried many times to reinit Firebase or even reinstall node and Firebase tools but still the same. Emulating locally doesn't work either you can see in the screenshot.

I will attach screenshot of index.js with project structure on left, firebase.json, deploy and emulate messages in cmd.

index.js:

enter image description here

firebase.json:

enter image description here

deploy in cmd:

enter image description here

emulate in cmd:

enter image description here

EDIT: when i deployed with specified function this came up:

deploy with specified function:

enter image description here

When i deployed with empty firebase.json this:

deploy with empty firebase.json:

enter image description here

deploy with firebase.json as advised under:

enter image description here

Sorry for posting pictures, but code doesnt format for me right.

2
  • On Stack Overflow, it's better to copy text of code and output into the question itself rather than showing screenshots. Commented Feb 25, 2020 at 21:02
  • Can you confirm that you are looking at the correct project on the Firebase Console? It's easy to be looking at another project and not realise. Commented Mar 6, 2020 at 3:21

1 Answer 1

1

You are not really deploying your function.

See, whenever you deploy a new function, the CLI will show the following message.

=== Deploying to '<PROJECT-ID>'... i deploying functions i functions: ensuring necessary APIs are enabled... ✔ functions: all necessary APIs are enabled i functions: preparing functions directory for uploading... i functions: packaged functions (26.61 KB) for uploading ✔ functions: functions folder uploaded successfully i functions: creating Node.js 8 function <FUNCTION-NAME>(us-central1)... ✔ functions[<FUNCTION-NAME>(us-central1)]: Successful create operation. Function URL (<FUNCTION-NAME>): https://us-central1-<PROJECT-ID>.cloudfunctions.net/<FUNCTION-NAME> ✔ Deploy complete! Project Console: https://console.firebase.google.com/project/<PROJECT-ID>/overview 

In your screenshot, you are not getting the Successful message.

Can you please try deploying your functions with an empty json as the firebase.json file?

Be sure to run firebase deploy --only functions:<FUNCTION_NAME> in the project's root folder. That way, you are telling the CLI to deploy an specific function, in this case it'd be helloWorld.

If you don't see the Successful message again, post here the results to try to make it work.

Edit.

Try changing your firebase.json to

{ "functions":{ "source": "functions/", "predeploy": [ "npm --prefix \"$RESOURCE_DIR\" run lint", "npm --prefix \"$RESOURCE_DIR\" run build" ] } } 

and then deploy again.

Sign up to request clarification or add additional context in comments.

3 Comments

I edited post with screenshots after done what you suggested
I added some extra things to try in the original answer.
i got another errors but different ones now, posted screenshot in post. I think it is just my computer something is just wrong with it :D

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.