Skip to content

Emulator cannot --export-on-exit when run via npm #334

@gregfenton

Description

@gregfenton

Environment:

  • MacOS Catalina: 10.15.6
  • shell: zsh 5.7.1
  • node: v14.4.0
  • npm: 6.14.7

I use an npm script to launch the emulators. In the scripts section of package.json I have:

"emulators": "firebase emulators:start --only firestore --import=./data --export-on-exit"

The emulators run fine when I run npm run emulators.

But when I terminate the command, things do not work as expected. Pressing ctrl+c shows that the emulators receive 2 SIGINTs:

^C
i  emulators: Received SIGINT (Ctrl-C) for the first time. Starting a clean shutdown.
i  emulators: Please wait for a clean shutdown or send the SIGINT (Ctrl-C) signal again to stop right now.
i  Automatically exporting data using --export-on-exit "./data" please wait for the export to finish...

⚠  emulators: Received SIGINT (Ctrl-C) 2 times. You have forced the Emulator Suite to exit without waiting for 2 subprocesses to finish. These processes may still be running on your machine:

 ┌────────────────────┬────────────────┬───────┐
 │ Emulator           │ Host:Port      │ PID   │
 ├────────────────────┼────────────────┼───────┤
 │ Emulator UI        │ localhost:4444 │ 87959 │
 ├────────────────────┼────────────────┼───────┤
 │ Firestore Emulator │ localhost:7777 │ 87959 │
 └────────────────────┴────────────────┴───────┘

 To force them to exit run:

 kill 87959 87959

It is the warning, about receiving Ctrl-C 2 times, that is the problem. Because of this issue, the data does not get exported on exit.

Running that same command but directly on the command line rather than via npm run emulators, and Ctrl-C shuts the emulators down cleanly and data exports as expected.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions