firebase-tools
firebase-tools copied to clipboard
Exit code is 0 even after functions deploy fails
[REQUIRED] Environment info
firebase-tools: 11.7.0
Platform: macOS
[REQUIRED] Test case
Use a reserved env variable name in your .env file and then attempt to deploy your functions (the env var should make them error out).
// .env
PWD="test"
[REQUIRED] Steps to reproduce
See above.
[REQUIRED] Expected behavior
$ firebase deploy --only functions
⚠ functions: failed to update function <function-path>
✨ Done in 18.35s.
$ echo $?
1 (or other non-zero code)
[REQUIRED] Actual behavior
$ firebase deploy --only functions
⚠ functions: failed to update function <function-path>
✨ Done in 18.35s.
$ echo $?
0
This issue does not have all the information required by the template. Looks like you forgot to fill out some sections. Please update the issue with more information.
Hi @christinecha thanks for filing this issue.
I'm taking a look, and it's turning out to be more subtle issue than I expected. Will post an update later when I get to the bottom of this rabbit hole.
I also just ran into this in version 11.16.1. Makes it slightly scary to deploy functions from CI
PS. Here's the workaround I came up with for the time being (cc @rogueg):
set -e
OUTPUT=$(yarn run server:deploy)
echo "${OUTPUT}"
if echo "${OUTPUT}" | grep -q 'failed to update'; then
exit 1;
fi
Unfortunately this has other issues, like it masks other error logs (there's probably a way around this too) but at least it prevents faulty deploys for us!
Any news on this? The problem still occurs for me ...
PS. Here's the workaround I came up with for the time being (cc @rogueg):
set -e OUTPUT=$(yarn run server:deploy) echo "${OUTPUT}" if echo "${OUTPUT}" | grep -q 'failed to update'; then exit 1; fi
Unfortunately this has other issues, like it masks other error logs (there's probably a way around this too) but at least it prevents faulty deploys for us!
Where can this be used or where do you use it currently?
Where can this be used or where do you use it currently?
We can use that on GitHub Actions. Like below.
- name: Deploy to Firebase
run: |
npm i -g [email protected]
set -e
OUTPUT=$(firebase deploy)
echo "${OUTPUT}"
if echo "${OUTPUT}" | grep -iq 'failed'; then
exit 1;
fi
env:
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}
Thanks a lot!
Hello!
Any news on this? We were surprised when we noticed that some functions hadn't been updated, even though our CI/CD pipeline did not show any errors.
We will now need to add a check similar to the suggestions above. But this seems to be a pretty issue, and users shouldn't need to implement these kind of hacks.
I've just tried this on the latest firebase-tools (12.8.1). I included the PWD
in my env file, and I got the following error. You can also see that the exit code is not zero (2) which means it failed.
i functions: updating Node.js 18 (2nd Gen) function helloWorld(us-central1)...
Could not create or update Cloud Run service helloworld, Container Healthcheck failed. Revision 'helloworld-00007-sax' is not ready and cannot serve traffic. The user-provided container failed to start and listen on the port defined provided by the PORT=8080 environment variable. Logs for this revision might contain more information.
Logs URL: https://console.cloud.google.com/logs/viewer?project=xxxxxxxxxxx
For more troubleshooting guidance, see https://cloud.google.com/run/docs/troubleshooting#container-failed-to-start
Functions deploy had errors with the following functions:
helloWorld(us-central1)
i functions: cleaning up build files...
Error: There was an error deploying functions
➜ firebase-tools-test echo $?
2
@christinecha - could you confirm if this is still a problem for you? And if so, could you give me further details on how to reproduce? Thanks.