firebase-tools icon indicating copy to clipboard operation
firebase-tools copied to clipboard

flag --export-on-exit fails when script is terminated with CTRL+C

Open DerrickAfrifa opened this issue 2 years ago • 4 comments

[REQUIRED] Environment info

firebase-tools: 11.4.0

Platform: macOS

[REQUIRED] Test case

run the following command in your terminal: firebase emulators:exec "sleep 20" --ui --only firestore --export-on-exit=./firebase-data once the script enters the sleep phase (you have 20 seconds) hit CTRL+C to kill the script.

[REQUIRED] Steps to reproduce

  1. Install firebase-tools globally
  2. run firebase emulators:exec "sleep 20" --ui --only firestore --export-on-exit=./firebase-data
  3. wait for the sleep command to be triggered
  4. hit CTRL+C to kill the emulators

[REQUIRED] Expected behavior

The emulator data should be successfully exported to ./firebase-data

[REQUIRED] Actual behavior

The export fails as the emulator is killed before there is a chance for the export to complete. This is the log:

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 "./firebase-data" please wait for the export to finish...
⚠  Script exited with signal: SIGINT
i  Found running emulator hub for project test-project at http://localhost:4400
i  Creating export directory /path/to/firebase-data
i  Exporting data to: /path/to/firebase-data
i  emulators: Received export request. Exporting data to /path/to/firebase-data.
i  emulators: Shutting down emulators.
i  ui: Stopping Emulator UI
⚠  Emulator UI has exited upon receiving signal: SIGINT
i  firestore: Stopping Firestore Emulator
⚠  emulators: Export failed: Failed to make request to http://0.0.0.0:8080/emulator/v1/projects/test-project:export
⚠ Export request failed, see emulator logs for more information.
⚠  Automatic export to "./firebase-data" failed, going to exit now...
i  emulators: Shutting down emulators.
i  firestore: Stopping Firestore Emulator
i  hub: Stopping emulator hub
i  hub: Stopping emulator hub
i  logging: Stopping Logging Emulator

DerrickAfrifa avatar Jul 28 '22 15:07 DerrickAfrifa

Any chance you can upload the logs (*.log) created? As mentioned in the output, the logs contain more information to debug the issue.

yuchenshi avatar Aug 01 '22 20:08 yuchenshi

Logs after pressing Ctrl+C


[debug] [2022-08-02T17:34:15.400Z] Received signal SIGINT (Ctrl-C) 1
[info]  
[info] i  emulators: Received SIGINT (Ctrl-C) for the first time. Starting a clean shutdown. 
[info] i  emulators: Please wait for a clean shutdown or send the SIGINT (Ctrl-C) signal again to stop right now. 
[info] i  Automatically exporting data using --export-on-exit "./firebase-export" please wait for the export to finish... 
[debug] [2022-08-02T17:34:15.403Z] >>> [apiv2][query] GET http://localhost:4400/ [none]
[error] 
[error] Error: Storage Emulator Rules runtime exited unexpectedly.
[debug] [2022-08-02T17:34:15.416Z] <<< [apiv2][status] GET http://localhost:4400/ 200
[debug] [2022-08-02T17:34:15.416Z] <<< [apiv2][body] GET http://localhost:4400/ {"version":"11.4.0","host":"localhost","port":4400}
[info] i  Found running emulator hub for project localess-dev at http://localhost:4400 
[info] i  Exporting data to: C:\Users\xyz\IdeaProjects\localess\firebase-export 
[debug] [2022-08-02T17:34:15.419Z] >>> [apiv2][query] POST http://localhost:4400/_admin/export [none]
[debug] [2022-08-02T17:34:15.419Z] >>> [apiv2][body] POST http://localhost:4400/_admin/export {"path":"C:\\Users\\xyz\\IdeaProjects\\localess\\firebase-export"}
[info] i  emulators: Received export request. Exporting data to C:\Users\xyz\IdeaProjects\localess\firebase-export. 
[debug] [2022-08-02T17:34:15.441Z] >>> [apiv2][query] POST http://localhost:8080/emulator/v1/projects/localess-dev:export [none]
[debug] [2022-08-02T17:34:15.442Z] >>> [apiv2][body] POST http://localhost:8080/emulator/v1/projects/localess-dev:export {"database":"projects/localess-dev/databases/(default)","export_directory":"firebase-export-1659461655439SVADq1","export_name":"firestore_export"}


alexcibotari avatar Aug 02 '22 17:08 alexcibotari

Hey @DerrickAfrifa. We need more information to resolve this issue but there hasn't been an update in 7 weekdays. I'm marking the issue as stale and if there are no new updates in the next 3 days I will close it automatically.

If you have more information that will help us get to the bottom of this, just add a comment!

google-oss-bot avatar Aug 11 '22 01:08 google-oss-bot

@tonyjhuang The logs seem to indicate issues on the rules runtime. Would you mind taking a look?

yuchenshi avatar Aug 11 '22 17:08 yuchenshi