firebase-tools
firebase-tools copied to clipboard
Error: It seems that you are running multiple instances of the emulator suite
[REQUIRED] Environment info
8.2.0 firebase-tools:
Platform: Macos
[REQUIRED] Test case
https://github.com/QuantumInformation/svelte-fullstack-starter
[REQUIRED] Steps to reproduce
Run firebase emulators:start at the root of the above url
[REQUIRED] Expected behavior
emulator to start
[REQUIRED] Actual behavior
the following output

debug log:
svelte-fullstack-starter git:(master) firebase emulators:start --debug
[2020-05-09T19:44:10.572Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
[2020-05-09T19:44:10.574Z] > authorizing via signed-in user
i emulators: Starting emulators: functions, firestore, database, hosting, pubsub
⚠ emulators: It seems that you are running multiple instances of the emulator suite for project svelte-fullstack-starter. This may result in unexpected behavior.
[2020-05-09T19:44:10.593Z] [hub] writing locator at /var/folders/wk/xpjrzzgj0937n2ys2j951wyr0000gn/T/hub-svelte-fullstack-starter.json
✔ hub: emulator hub started at http://localhost:4400
⚠ Your requested "node" version "8" doesn't match your global version "12"
✔ functions: functions emulator started at http://localhost:5002
⚠ firestore: Did not find a Cloud Firestore rules file specified in a firebase.json config file.
⚠ firestore: The emulator will default to allowing all reads and writes. Learn more about this option: https://firebase.google.com/docs/emulator-suite/install_and_configure#security_rules_configuration.
[2020-05-09T19:44:10.875Z] Ignoring unsupported arg: projectId
[2020-05-09T19:44:10.875Z] Ignoring unsupported arg: auto_download
[2020-05-09T19:44:10.875Z] Starting firestore emulator with command {"binary":"java","args":["-Duser.language=en","-jar","/Users/nikos/.cache/firebase/emulators/cloud-firestore-emulator-v1.11.3.jar","--host","localhost","--port",8080,"--functions_emulator","localhost:5002"],"optionalArgs":["port","webchannel_port","host","rules","functions_emulator","seed_from_export"],"joinArgs":false}
i firestore: firestore emulator logging to firestore-debug.log
[2020-05-09T19:44:11.974Z] API endpoint: http://localhost:
[2020-05-09T19:44:11.974Z] 8080
If you are using a library that supports the FIRESTORE_EMULATOR_HOST environment variable, run:
export FIRESTORE_EMULATOR_HOST=localhost:8080
Dev App Server is now running.
✔ firestore: firestore emulator started at http://localhost:8080
i firestore: For testing set FIRESTORE_EMULATOR_HOST=localhost:8080
⚠ database: Did not find a Realtime Database rules file specified in a firebase.json config file.
⚠ database: The emulator will default to allowing all reads and writes. Learn more about this option: https://firebase.google.com/docs/emulator-suite/install_and_configure#security_rules_configuration.
[2020-05-09T19:44:12.158Z] Ignoring unsupported arg: projectId
[2020-05-09T19:44:12.158Z] Ignoring unsupported arg: auto_download
[2020-05-09T19:44:12.158Z] Starting database emulator with command {"binary":"java","args":["-Duser.language=en","-jar","/Users/nikos/.cache/firebase/emulators/firebase-database-emulator-v4.4.1.jar","--host","localhost","--port",9000,"--functions_emulator_host","localhost","--functions_emulator_port",5002],"optionalArgs":["port","host","functions_emulator_port","functions_emulator_host"],"joinArgs":false}
i database: database emulator logging to database-debug.log
[2020-05-09T19:44:13.695Z] 21:44:13.694 [NamespaceSystem-akka.actor.default-dispatcher-5] INFO akka.event.slf4j.Slf4jLogger - Slf4jLogger started
[2020-05-09T19:44:13.874Z] 21:44:13.873 [main] INFO com.firebase.server.forge.App$ - Listening at localhost:9000
✔ database: database emulator started at http://localhost:9000
i database: For testing set FIREBASE_DATABASE_EMULATOR_HOST=localhost:9000
[2020-05-09T19:44:13.950Z] > refreshing access token with scopes: ["email","https://www.googleapis.com/auth/cloud-platform","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","openid"]
[2020-05-09T19:44:13.950Z] >>> HTTP REQUEST POST https://www.googleapis.com/oauth2/v3/token
<request body omitted>
[2020-05-09T19:44:14.125Z] <<< HTTP RESPONSE 200 {"content-type":"application/json; charset=utf-8","vary":"X-Origin, Referer, Origin,Accept-Encoding","date":"Sat, 09 May 2020 19:44:14 GMT","server":"scaffolding on HTTPServer2","cache-control":"private","x-xss-protection":"0","x-frame-options":"SAMEORIGIN","x-content-type-options":"nosniff","alt-svc":"h3-27=\":443\"; ma=2592000,h3-25=\":443\"; ma=2592000,h3-Q050=\":443\"; ma=2592000,h3-Q049=\":443\"; ma=2592000,h3-Q048=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000,quic=\":443\"; ma=2592000; v=\"46,43\"","accept-ranges":"none","transfer-encoding":"chunked"}
[2020-05-09T19:44:14.137Z] >>> HTTP REQUEST GET https://firebase.googleapis.com/v1beta1/projects/svelte-fullstack-starter/webApps/-/config
[2020-05-09T19:44:14.786Z] <<< HTTP RESPONSE 200 {"content-type":"application/json; charset=UTF-8","vary":"X-Origin, Referer, Origin,Accept-Encoding","date":"Sat, 09 May 2020 19:44:14 GMT","server":"ESF","cache-control":"private","x-xss-protection":"0","x-frame-options":"SAMEORIGIN","x-content-type-options":"nosniff","alt-svc":"h3-27=\":443\"; ma=2592000,h3-25=\":443\"; ma=2592000,h3-Q050=\":443\"; ma=2592000,h3-Q049=\":443\"; ma=2592000,h3-Q048=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000,quic=\":443\"; ma=2592000; v=\"46,43\"","accept-ranges":"none","transfer-encoding":"chunked"}
i hosting: Serving hosting files from: public
✔ hosting: Local server: http://localhost:5000
✔ hosting: hosting emulator started at http://localhost:5000
[2020-05-09T19:44:14.811Z] Ignoring unsupported arg: projectId
[2020-05-09T19:44:14.811Z] Ignoring unsupported arg: auto_download
[2020-05-09T19:44:14.811Z] Starting pubsub emulator with command {"binary":"/Users/nikos/.cache/firebase/emulators/pubsub-emulator-0.1.0/pubsub-emulator/bin/cloud-pubsub-emulator","args":["--host=localhost","--port=8085"],"optionalArgs":["port","host"],"joinArgs":true}
i pubsub: pubsub emulator logging to pubsub-debug.log
[2020-05-09T19:44:14.985Z] This is the Google Pub/Sub fake.
[2020-05-09T19:44:14.986Z] Implementation may be incomplete or differ from the real system.
[2020-05-09T19:44:15.015Z] May 09, 2020 9:44:14 PM com.google.cloud.pubsub.testing.v1.Main main
INFO: IAM integration is disabled. IAM policy methods and ACL checks are not supported
[2020-05-09T19:44:15.547Z] May 09, 2020 9:44:15 PM io.gapi.emulators.netty.NettyUtil applyJava7LongHostnameWorkaround
INFO: Unable to apply Java 7 long hostname workaround.
[2020-05-09T19:44:15.630Z] May 09, 2020 9:44:15 PM com.google.cloud.pubsub.testing.v1.Main main
INFO: Server started, listening on 8085
✔ pubsub: pubsub emulator started at http://localhost:8085
i functions: Watching "/Users/nikos/WebstormProjects/svelte-fullstack-starter/functions" for Cloud Functions...
[2020-05-09T19:44:15.845Z] [worker-pool] addWorker(~diagnostic~)
[2020-05-09T19:44:15.846Z] [worker-pool] Adding worker with key ~diagnostic~, total=1
[2020-05-09T19:44:15.846Z] [worker-pool] submitWork(triggerId=)
[2020-05-09T19:44:15.847Z] [worker-~diagnostic~-d5e3219e-99af-4c9f-85e3-90482760af04]: Assigning socketPath: /var/folders/wk/xpjrzzgj0937n2ys2j951wyr0000gn/T/fire_emu_31830.sock
[2020-05-09T19:44:15.847Z] [worker-~diagnostic~-d5e3219e-99af-4c9f-85e3-90482760af04]: BUSY
[2020-05-09T19:44:15.991Z] May 09, 2020 9:44:15 PM io.gapi.emulators.grpc.GrpcServer$3 operationComplete
INFO: Adding handler(s) to newly registered Channel.
[2020-05-09T19:44:16.076Z] [runtime-status] [31830] Functions runtime initialized. {"cwd":"/Users/nikos/WebstormProjects/svelte-fullstack-starter/functions","node_version":"12.13.1"}
[2020-05-09T19:44:16.077Z] [runtime-status] [31830] Disabled runtime features: undefined
[2020-05-09T19:44:16.080Z] [runtime-status] [31830] Resolved module firebase-admin {"declared":true,"installed":true,"version":"8.12.1","resolution":"/Users/nikos/WebstormProjects/svelte-fullstack-starter/functions/node_modules/firebase-admin/lib/index.js"}
[2020-05-09T19:44:16.082Z] [runtime-status] [31830] Resolved module firebase-functions {"declared":true,"installed":true,"version":"3.6.1","resolution":"/Users/nikos/WebstormProjects/svelte-fullstack-starter/functions/node_modules/firebase-functions/lib/index.js"}
[2020-05-09T19:44:16.082Z] [runtime-status] [31830] Set PUBSUB_EMULATOR_HOST to localhost:8085
[2020-05-09T19:44:16.085Z] [runtime-status] [31830] Outgoing network have been stubbed. [{"name":"http","status":"mocked"},{"name":"http","status":"mocked"},{"name":"https","status":"mocked"},{"name":"https","status":"mocked"},{"name":"net","status":"mocked"}]
[2020-05-09T19:44:16.133Z] [runtime-status] [31830] Checked functions.config() {"config":{}}
[2020-05-09T19:44:16.133Z] [runtime-status] [31830] Resolved module firebase-functions {"declared":true,"installed":true,"version":"3.6.1","resolution":"/Users/nikos/WebstormProjects/svelte-fullstack-starter/functions/node_modules/firebase-functions/lib/index.js"}
[2020-05-09T19:44:16.134Z] [runtime-status] [31830] Resolved module firebase-admin {"declared":true,"installed":true,"version":"8.12.1","resolution":"/Users/nikos/WebstormProjects/svelte-fullstack-starter/functions/node_modules/firebase-admin/lib/index.js"}
[2020-05-09T19:44:16.134Z] [runtime-status] [31830] Resolved module firebase-functions {"declared":true,"installed":true,"version":"3.6.1","resolution":"/Users/nikos/WebstormProjects/svelte-fullstack-starter/functions/node_modules/firebase-functions/lib/index.js"}
[2020-05-09T19:44:16.134Z] [runtime-status] [31830] firebase-admin has been stubbed. {"adminResolution":{"declared":true,"installed":true,"version":"8.12.1","resolution":"/Users/nikos/WebstormProjects/svelte-fullstack-starter/functions/node_modules/firebase-admin/lib/index.js"}}
[2020-05-09T19:44:16.137Z] [runtime-status] [31830] initializeApp(DEFAULT) {"databaseURL":"https://svelte-fullstack-starter.firebaseio.com","storageBucket":"svelte-fullstack-starter.appspot.com","projectId":"svelte-fullstack-starter"}
✔ functions[listUsers]: http function initialized (http://localhost:5002/svelte-fullstack-starter/us-central1/listUsers).
✔ functions[upsertUsername]: http function initialized (http://localhost:5002/svelte-fullstack-starter/us-central1/upsertUsername).
✔ emulators: All emulators started, it is now safe to connect.
[2020-05-09T19:44:16.139Z] [worker-~diagnostic~-d5e3219e-99af-4c9f-85e3-90482760af04]: IDLE
Same on Linux with firebase-tools:8.2.0
Start/Stop all emulators command shows warning after repeated use.
If I run firebase emulators:start for the first time I see normal expected output:
╰─$ firebase emulators:start 1 ↵
i emulators: Starting emulators: functions, firestore, database, hosting, pubsub
✔ hub: emulator hub started at http://localhost:4400
✔ functions: functions emulator started at http://localhost:5001
<...>
But then I press CTRL+C seems that some resources are not cleaned-up (no msg about stopping emulators)
If I try to run firebase emulators:start for the 2nd time I see output with warning:
╰─$ firebase emulators:start 130 ↵
i emulators: Starting emulators: functions, firestore, database, hosting, pubsub
⚠ emulators: It seems that you are running multiple instances of the emulator suite for project my-project. This may result in unexpected behavior.
✔ hub: emulator hub started at http://localhost:4400
✔ functions: functions emulator started at http://localhost:5001
<...>
Start/Stop --only emulators command works as expected after repeated use.
I start command firebase emulators:start --only functions,firestore,database
╰─$ firebase emulators:start --only functions,firestore,database 1 ↵
i emulators: Starting emulators: functions, firestore, database
✔ hub: emulator hub started at http://localhost:4400
✔ functions: functions emulator started at http://localhost:5001
<...>
Then I press CTRL+C I see printed out message about emulators being stopped
i emulators: Shutting down emulators.
i hub: Stopping emulator hub
i functions: Stopping functions emulator
i firestore: Stopping firestore emulator
i database: Stopping database emulator
I can repeat this as many times, and never see It seems that you are running multiple instances<...> warning
Maybe only one type of emulator is not being stopped which is not in my --only functions,firestore,database list. I haven't tested this much. But maybe this help to find root cause.
I restarted my system and this error went away, close ticket?
No. Run firebase emulators:start two time and you will get this warning again
worked ok this time

@audkar it seems that the real bug in your situation is Ctrl+C is not always causing a clean shutdown.
@QuantumInformation what happens is each time you start up the emulator hub it writes a "locator" file to /${os.tmpdir()}/hub-${projectId}.json. So on a linux machine that might be /tmp/hub-project123.json. It uses this file so that cross-process commands like emulators:export can find each other.
If you ever run into this problem and can't get rid of it, it's safe to delete that file manually.
it seems that the real bug in your situation is Ctrl+C is not always causing a clean shutdown.
@samtstern Jup. To summarize my previous comment:
- Pressing
CTRL+Confirebase emulators:startcommand exits instantaneously (without printingemulators: Shutting down emulators. <...>) - Pressing
CTRL+Confirebase emulators:start --only functions,firestore,databaseprintsemulators: Shutting down emulators.message and takes a second to exit to shell.
Is this not reproducible on your machine?
Oh. I see. On my project hosting emulator doesn't start. I issue CTRL-C command before
✔ emulators: All emulators started, it is now safe to connect.
And then state is not cleared properly. Next time I try to start emulators I get that warning It seems that you are running multiple instances
@audkar oh wow you're totally right, thank you for figuring this out! I will send a PR to fix this.
Oh wait I spoke too soon. I cannot reproduce this on my computer (I thought I could, but it was an error on my side). I am able to shut down cleanly with or without --only
I am able to shut down cleanly with or without --only
@samtstern Yes --only option is not relevant in this case. If emulators start-up sequence is interrupted with CTRL-C before all emulators are started successfully:
✔ emulators: All emulators started, it is now safe to connect.
then state is not cleared properly.
Have a fix going here: https://github.com/firebase/firebase-tools/pull/2230
Hey I'm trying to follow this thread but I'm a little lost here. I'm trying to use the emulator and I'm getting the same issue. Has it been fixed in #2230 and I should just wait until it gets added to the firebase tools?
edit: after looking back over this page, it's a different issue in that I can't make the emulator work, period, and so I don't think it can be an instance shutdown issue, as I can't ever get the (firebase) emulator to start.
@Elijer if you're using the latest version of the CLI (8.4.1) you should not be seeing this often (unless you actually are running multiple copies of the emulator).
The emulator hub creates a sentinel file when it starts up. If it fails to shut down properly, that file can be left behind. When you start the emulators again if the file is already present you will see this warning.
We improved the reliability of the shutdown code to make this happen less often.
@samstern thanks for the quick reply. So I think I'm missing something about npm: when I do npm install -g firebase-tools I get [email protected] but when I print npm firebase-tools -v I get 6.14.4. Sorry I know this isn't how the issues should be used.
I don't think I'm running multiple copies of the emulator, but I might also be missing something there. I don't have any other terminals open that are running any processes. Is there any other way I could have other copies of the emulator running?
How do I find the sentinel file to delete it?
@Elijer hmmm sounds like something is going wrong with your npm setup. Unfortunately it's pretty hard to guess what that issue is from here.
If you run emulators:start with the --debug flag you can look for a log message like this:
[hub] writing locator at <path>
That will tell you where the sentinel file is.
@samstern Hey thanks a lot for your help.
I followed the filepath after using the --debug flag and deleted the file completely. I still get this:
Elijahs-Air:cafe-infinite jah$ firebase emulators:start
i emulators: Starting emulators: functions, firestore, hosting
⚠ emulators: It seems that you are running multiple instances of the emulator suite for project cafe-infinite. This may result in unexpected behavior.
⚠ Your requested "node" version "8" doesn't match your global version "12"
⚠ firestore: Did not find a Cloud Firestore rules file specified in a firebase.json config file.
⚠ firestore: The emulator will default to allowing all reads and writes. Learn more about this option: https://firebase.google.com/docs/emulator-suite/install_and_configure#security_rules_configuration.
i firestore: Firestore Emulator logging to firestore-debug.log
Error: firestore: Firestore Emulator has exited with code: 1
I deleted and reinstalled firebase. Could you point me in a direction? I'm out of ideas.
@Elijer in those logs I don't see any message like this one:
i emulators: Shutting down emulators.
Which implies that you're not using the latest version of the Firebase CLI. What does firebase --version show you? It should be 8.4.1 if you're on the latest.
@samtstern When I run firebase --version I get 8.4.1 :/
I made a new project in the console, initiated it into an empty folder on a different user on my computer, and tried using the emulators again. I don't have the console message, but I'm pretty sure there was no ⚠ emulators: It seems that you are running multiple instances of the emulator suite for project agggghh-38157. This may result in unexpected behavior. That time.
And then, I went into package-lock.json and I changed the firestore port. Again, that warning line was missing:
Elijahs-Air:aggghh Kua$ firebase emulators:start
i emulators: Starting emulators: functions, firestore, hosting
⚠ Your requested "node" version "8" doesn't match your global version "12"
i firestore: Firestore Emulator logging to firestore-debug.log
Error: firestore: Firestore Emulator has exited with code: 1
edit: meant to say 'firebase.json'
Ok it seems like we solved the multiple instances issue. Could you file a new issue for the problem you're seeing with the Firestore emulator. Include the output of emulators:start --debug
On Fri, May 29, 2020 at 10:05 AM Elijah Kennedy [email protected] wrote:
@samtstern https://github.com/samtstern When I run firebase --version I get 8.4.1 :/
I made a new project in the console, initiated it into an empty folder on a different user on my computer, and tried using the emulators again. I don't have the console message, but I'm pretty sure there was no ⚠ emulators: It seems that you are running multiple instances of the emulator suite for project agggghh-38157. This may result in unexpected behavior. That time.
And then, I went into package-lock.json and I changed the firestore port. Again, that warning line was missing:
`Elijahs-Air:aggghh Kua$ firebase emulators:start i emulators: Starting emulators: functions, firestore, hosting ⚠ Your requested "node" version "8" doesn't match your global version "12" i firestore: Firestore Emulator logging to firestore-debug.log
Error: firestore: Firestore Emulator has exited with code: 1`
— You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub https://github.com/firebase/firebase-tools/issues/2228#issuecomment-635990477, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACATB2RVIL54ZGI62BU7EKDRT66KRANCNFSM4M45V2SQ .
Yeah, I'll start a new issue. To be clear, the
⚠ emulators: It seems that you are running multiple instances of the emulator suite for project firestripe-boilerplate. This may result in unexpected behavior.
still comes up every time afterwards, just not the first time firestore emulators:start is run after changing the port in the firebase.json, or after initiating a new project.
Okay here's the new issue: https://github.com/firebase/firebase-tools/issues/2307
Couldn't be there an firebase emulators:stop to kill any running emulators?
Edit: this seems closed but still happens here.
I had this problem too, in having instances of the emulator working even after finishing/shut down (Ctrl + C).
So, I used a script on my package.json with all the ports I use in my firebase.json file, and after the shot down I run the script, I believe it can be a good workaround.
package.json
"scripts": {
...
"stopall": "lsof -t -i:2000 -i:6001 -i:9080 -i:8086 -i:9099 | xargs kill -9",
...
}
firebase.json
...
"emulators": {
"hosting": {
"port": 2000
},
"functions": {
"port": 6001
},
"firestore": {
"port": 9080
},
"pubsub": {
"port": 8086
},
"auth": {
"port": 9099
},
"ui": {
"enabled": true
},
}
...
On the project root:
Ctrl + Cnpm run stopall
I had this problem too, in having instances of the emulator working even after finishing/shut down (Ctrl + C).
So, I used a script on my package.json with all the ports I use in my firebase.json file, and after the shot down I run the script, I believe it can be a good workaround.
package.json"scripts": { ... "stopall": "lsof -t -i:2000 -i:6001 -i:9080 -i:8086 -i:9099 | xargs kill -9", ... }
firebase.json... "emulators": { "hosting": { "port": 2000 }, "functions": { "port": 6001 }, "firestore": { "port": 9080 }, "pubsub": { "port": 8086 }, "auth": { "port": 9099 }, "ui": { "enabled": true }, } ...On the project root:
Ctrl + Cnpm run stopall
That's good! I've been using sudo pkill node and sometimes java, but this may kill other non related processes.
Have the same issue, the npm script is a good workaround
Had the same issue and then read carefully all the messages on the terminal and here. I have a habit of pressing Ctrl + C a few times to completely kill the local development process. With the emulator suite, you only need to press Ctrl + C once then wait for all hubs to shut down. When I do Ctrl + C twice too quickly, some of the processes didn't finish exiting so the emulator is left hanging already when I tried to start the emulator again.
@samtstern this issue is still happening, even in 9.20.0.
this still happens in 10
@jaredgibb which exact version is the problem happening?
10.1.14 (I think) but after reading through some other threads, I ran the update code from the cli and it fixed the issue. Sorry for not coming back! Thanks for checking in!!