6

Environment info

firebase --version --> 11.1.0

node -v --> v16.15.1

npm -v --> 8.11.0

Platform:

Pop!_OS 22.04 LTS 64-bit

Steps to reproduce

1). run firebase init functions

2). Select Use an existing project and choose my project.

3). Select Javascript for the language.

4). Type N and press enter to not use eslint.

5). Type Y and press enter to install dependencies.

6). run firebase emulators:start or firebase emulators:start --only functions

7). Open functions/index.js and uncomment the helloWorld example, and save.

Expected behavior

I expect the functions emulator to detect the changes to the javascript code and to automatically apply those changes without restarting the emulator (manually).

Actual behavior

Nothing changes. I have to restart the emulator to use the helloWorld function. Or if the function was there when the emulator was started I have to restart it to see changes made to the function itself. If I make changes to the firestore.rules file while running the firestore emulator those changes are registered without restarting the emulator(s) like it's supposed to.

NoahGav
  • 251
  • 4
  • 12
  • Please someone tell me if I'm being an idiot. When I start the emulator it says functions: Watching \"path\" for Cloud Functions... Does this not mean what I think it means? If so how to I update functions without restarting every emulator I have running? – NoahGav Jun 29 '22 at 04:01
  • Searching for a solution with NestJS also – Andrea Mar 21 '23 at 10:56

1 Answers1

1

If you're using "native" Node.js, any changes/modification in the code after running the emulator will not be reflected. By using different Javascript library, you can transpile/compile your code as watch mode before running Firebase emulator to see the changes upon modification of the code. You can also refer to this documentation:

Code changes you make during an active session are automatically reloaded by the emulator. If your code needs to be transpiled (TypeScript, React) make sure to do so before running the emulator. You can run your transpiler in watch mode with commands like tsc -w to transpile and reload code automatically as you save.

Chanpols
  • 1,184
  • 1
  • 3
  • 13
  • 1
    I'm not using "native" Node.js or typescript. It isn't automatically updating. I have to fully restart all emulators to see the changes. – NoahGav Jun 29 '22 at 10:11
  • If you think that there is a bug in the emulator while reproduction steps, post the project GitHub instead of Stack Overflow. [GitHub](https://github.com/firebase/firebase-tools) – Chanpols Jun 30 '22 at 06:28