Skip to content

Still not a clean shutdown on the emulators even when noting @simondotm/nx-firebase:serve #249

@stevebrowndotco

Description

@stevebrowndotco

(nx 19, node 20.17.0)

Hello, I love this extension but I am having issues. I noticed that here https://github.com/simondotm/nx-firebase/blob/main/docs/nx-firebase-emulators.md that you are using your own script to attempt to properly do a clean shutdown of the firebase emulators.

I can confirm this isn't working, and also as discussed here #238 the process shuts down immediately, and one of the projects spits an error code 128. The result of this that the emulators dont finish properly, and the --export-on-exit functionality incorrectly saves the data in the monorepo root not the project .emulator folder (and duplicates each time).

I have a workaround for now to use run-p from npm-run-all for the scripts directly in the package json (I tried using concurrently but that doesnt do a clean shut down either).

So for now I have commented out emulators in project.json:

    "serve": {
      "executor": "@simondotm/nx-firebase:serve",
      "options": {
        "commands": [
          "nx run project:watch"
          // "nx run project:emulate"
        ]
      }
    },

and updated my run script like so: (End goal is to simply run only project:dev script, and to not touch the others)

Package.json

//
"scripts": {
   "project:dev": "run-p project:emulate project:main"
   "project:main": "nx nx-main-project"
   "project:emulate": "yarn project:close-ports && firebase emulators:start --import=apps/nx-firebase-project/.emulators --export-on-exit"
   "project:close-ports": "nx killports nx-firebase-project"
}
//

This provides a clean shutdown

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions