Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firebase functions emulator does not watch for changes

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.

like image 560
NoahGav Avatar asked Jul 03 '26 16:07

NoahGav


1 Answers

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.

like image 197
Chanpols Avatar answered Jul 05 '26 04:07

Chanpols



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!