Skip to content

No JDK causes emulators:exec to immediately exit with a success code #7974

Closed

Description

@jamesdaniels

I was seeing unexpected success on a test suite, it turns out I did not have the JDK installed correctly on my new machine.

When failures such as this occur firebase emulators:exec "exit 1" returns a success code and only i emulators: Shutting down emulators.

I didn't see I what the issue was until I used --debug. This could be a footgun for those using the emulators for integration tests. Having seen this I expect there may be similar classes of errors.

Activity

  1. changed the title [-]No JDK causes emulators:exec to immediately exit with a successful error code & no useful error[/-] [+]No JDK causes emulators:exec to immediately exit with a successful error code[/+] on Nov 20, 2024
  2. changed the title [-]No JDK causes emulators:exec to immediately exit with a successful error code[/-] [+]No JDK causes emulators:exec to immediately exit with a success code[/+] on Nov 20, 2024
  3. aalej commented on Nov 20, 2024

    @aalej
    Contributor

    Thanks for raising this @jamesdaniels. I'm able to reproduce the issue. As you mentioned, this would cause a false positive on integration tests if the user doesn't have JDK installed, or if it was incorrectly installed in their machine.

    I'll mark this as reproducible and discuss this with some of our colleagues.

  4. joehan commented on Nov 20, 2024

    @joehan
    Member

    Thanks for catching this James - looks like we broke this while trying to fix a different issue that was breaking error reporting in the VSCode extension - https://github.com/firebase/firebase-tools/blob/master/src/emulator/commandUtils.ts#L471 is catching the error so it can message the extension, but it never rethrows it.

    PR incoming shortly to fix this

  5. erayerdin commented on May 1, 2025

    @erayerdin

    Issue still persist. Although Playwright fails with tests, the exit code is zero.

    Also, as @jamesdaniels suggested, trying firebase emulators:exec "exit 1" also does not lead non-zero exit code.

  6. aalej commented on May 5, 2025

    @aalej
    Contributor

    Hey @erayerdin, I tried to reproduce this issue again and running firebase emulators:exec "exit 1" outputs a non-zero exit code:

    $ firebase --version
    14.2.0
    $ firebase emulators:exec "exit 1"
    i  emulators: Shutting down emulators.
    
    Error: Could not spawn `java -version`. Please make sure Java is installed and on your system PATH.
    $ echo $?
    1
    

    I think the issue might be related to how the Playwright test script fails. Could you open a new issue and provide details on how you set up your tests?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions