Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

firebase deploy returns an exit code == 0 even if a function failed to be deployed #6989

Open
Philmod opened this issue Apr 11, 2024 · 4 comments

Comments

@Philmod
Copy link

Philmod commented Apr 11, 2024

[REQUIRED] Environment info

Version: 13.7.1

OS: Ubuntu

[REQUIRED] Test case

Deployment with a failing function update.

[REQUIRED] Steps to reproduce

firebase deploy returns an exit code of 0 even if there is a failure like:

# firebase deploy
⚠  functions: failed to update function projects/philmod-godds/locations/us-central1/functions/authentication-delete
Failed to update function projects/philmod-godds/locations/us-central1/functions/authentication-delete

# echo $?
0

[REQUIRED] Expected behavior

Returns an exit code != 0 if it failed.

[REQUIRED] Actual behavior

Return an exit code == 0 even in case of a failure.

@google-oss-bot
Copy link
Contributor

This issue does not seem to follow the issue template. Make sure you provide all the required information.

@Philmod
Copy link
Author

Philmod commented Apr 11, 2024

This issue does not seem to follow the issue template. Make sure you provide all the required information.

fixed

@aalej
Copy link
Contributor

aalej commented Apr 12, 2024

Hey @Philmod, thanks for filing this issue. I’m currently unable to reproduce the behavior you mentioned. I tried firebase deploy using the ff:

functions/index.js

const functions = require("firebase-functions/v1");
const logger = require("firebase-functions/logger");

exports.authDelete = functions.auth.user().onDelete((user) => {
 logger.log("---- user1 ----");
 logger.debug(user);
});

functions/.env - setting PATH causes the function update to fail

PATH="some/path"

And an error is being raised, which returns a non-zero exit code(2).

i  functions: updating Node.js 18 (1st Gen) function authDelete(us-central1)...
⚠  functions: failed to update function projects/PROJECT_ID/locations/us-central1/functions/authDelete
Failed to update function projects/PROJECT_ID/locations/us-central1/functions/authDelete

Functions deploy had errors with the following functions:
        authDelete(us-central1)
i  functions: cleaning up build files...

Error: There was an error deploying functions

Having trouble? Try again or contact support with contents of firebase-debug.log
USER$ echo $?
2

To get a better understanding of what’s causing the failed update to not raise an error, could you provide code snippets of the functions you’re trying to deploy, and additional details on your project’s setup such as env variables being set?

@aalej aalej added the Needs: Author Feedback Issues awaiting author feedback label Apr 12, 2024
@Philmod
Copy link
Author

Philmod commented Apr 15, 2024

Hey @aalej,

I'm using Google Cloud Build to deploy the firebase functions, using this docker image.
I wonder if that's the reason the exit code is swallowed?

I don't think the function in itself has anything special. No specific env variables set either.

@google-oss-bot google-oss-bot added Needs: Attention and removed Needs: Author Feedback Issues awaiting author feedback labels Apr 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants