Firebase emulator prevent log window from opening - firebase

When I run the firebase emulators:start command on Windows 10, it opens up a console with what looks like a java program outputting log events from the emulator suite. Is there any way to prevent this window from opening?
Thanks!
edit: This window doesn't even close after emulators:exec finishes its command, preventing a proper cleanup.

First of all , this link can help you on how to shutdown correctly the JVMs:
Shut down JVM when Firebase emulator closes
Since you're talking about Java console , then you should use javaw.exe instead of java.exe ! Javaw prevents logs from appearing in console . I'm not an expert of firebase but I believe there's a config file in which there's a call to Java binary which launches the JVM and finally change the java by javaw

Related

How to hide java console when running "firebase emulators:start"?

After I run the command firebase emulators:start, the java console pops up:
How can I run the firebase emulators without showing the console?
Is there a way to run the console in hidden mode?
There's an open bug here, right now there's no flag provided by Firebase to avoid the popup:
https://github.com/firebase/firebase-tools/issues/3506

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.
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.

Shut down JVM when Firebase emulator closes

firebase-tools is an NPM package that uses the JVM. It includes an emulators:start command which fires up the JVM, and it has the JVM use some ports (defined in settings) for the emulators' input/output.
I use MacOS. I use a VSCode terminal to start/end the emulators, and define the details of how to start using an NPM script. Like this:
npm run build && firebase emulators:start --only functions,auth,firestore,database --import ./db-temp
In other words, run the build script, then start some emulator services.
So when running the emulators, I:
Open a terminal,
Navigate to the folder containing the script
Run the script (npm run serve)
This gives me a convenient place to get feedback from the emulators for things like errors, network activity, etc.
If I close VSCode using VSCode's X button, everything in VSCode is immediately shut down. When the terminal is closed, the JVM doesn't detect this and quit: it keeps running. Then when I open VSCode and try running my script again, it tells me that the port normally used by the emulators is still open, because the JVM didn't shut down properly. So I have to track down the JVM process, Force Quit it, and then everything works fine.
To shut the emulators down properly, I have to go to the terminal process running the emulators, press ALT+C to close the process, and then close VSCode. This extra step is inconvenient, and easily forgotten.
Can I convince the JVM to shut down when its originating process terminates via a configuration option? I looked through the configuration options on my local machine via java and java -x, and didn't see anything promising, but I am sure that there are people who know much more about Java than I do.
The Firebase emulator has an environment variable available for Java configuration.
I would be open to other options if available: telling VSCode to automatically shut down terminals properly before exiting, for example.
Or must this be handled by firebase-tools itself, perhaps via a ShutdownHook?
After a little conversation with Firebase and some troubleshooting, I learned a few things:
This issue only occurs when running firebase emulators:start --only firestore,database: when they run together, the Firestore process never closes. Start either one by itself and everything closes fine. This leads me to suspect that this is a bug.
This is reproducible outside VSCode, leading me to suspect that the issue has nothing to do with VSCode.
I filed https://github.com/firebase/firebase-tools/issues/4657. We'll see how it turns out.

.net core console application on PCF

I'm able to deploy a .net core console app on PCF which raises some internal events and runs for sometime(with help of Thread.Delay()) and exits. I want to be able to start and stop this app remotely, using a batch file from windows machine.
When I push this app to PCF I have explicitly put --no-start flag in the push command. The app gets deployed and doesn't starts and I can start this remotely with cf start command. Once it exits successfully PCF tries to restart it considering it as crashed so in order to restart i would first need to cf stop and then use start command.
I need help in understanding - if there is any other better way to do this. Originally we were planning to use Tasks on PCF; but as per my understanding Tasks are command which runs on other application(please correct me if I am wrong)
Any thoughts will help.
Thanks in advance.
I modified my app logic to achieve this. I did the following -
Deployed app with --no-start flag
In the app entry method I checking the value of arg passed from command line
if arg==required_key then run the job else return
I do a cf start which builds, stages the app and the app gets started but no results displayed on console
cf stop
cf run-task APP_NAME "dotnet appname.dll required_key"
The above task runs one time and destroys itself.

CloudPebble PebbleJS Emulator hanging

I'm trying to emulate an app that works on my pebble, using PebbleJS. When I install it on the emulator, it hangs on "Preparing to install app…"
I can't see any logs to see where or why it hung.
Try a different browser,refreshing browser or clicking on the cog and selecting shut down and then installing on emulator, Try to use "console.log()" as much as you can to see how far your code goes before it hangs

Resources