You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, it uses a combination of environment variables and the firebase.json file to see which emulators should be enabled. However, I believe there is a better option. firebase.json and the env variables just tell the emulator suite the desired ports. While most of the services will shutdown if the port is unavailable, not all do:
⚠ logging: Logging Emulator unable to start on port 4500, starting on 4501 instead.
The firebase emulator hub offers a REST API to query the running emulators and get back the actual host and port in use. I think this would be a more robust solution.
We could simply fetch this endpoint, and capture the host and ports from it. A rough example below:
constemulators=await$fetch<FirebaseEmulatorConfig>(`http://${HOST}:4400/emulators`)if(emulators.firestore){const{ host, port }=emulators.firestore;connectFirestoreEmulator(firestore,host,port);}if(emulators.auth){const{ host, port }=emulators.auth;connectAuthEmulator(auth,`http://${host}:${port}`);}
I've been using this in my testing to connect to the emulators and it works fine. Just thought I'd post this idea to get your thoughts.
The text was updated successfully, but these errors were encountered:
Discussed in #1425
Originally posted by luc122c September 8, 2023
I was taking a look at the way Vuefire detects and connects to the Firebase emulators:
vuefire/packages/nuxt/src/module/emulators.ts
Line 55 in cab2e95
firebase.json
file to see which emulators should be enabled. However, I believe there is a better option.firebase.json
and the env variables just tell the emulator suite the desired ports. While most of the services will shutdown if the port is unavailable, not all do:The firebase emulator hub offers a REST API to query the running emulators and get back the actual host and port in use. I think this would be a more robust solution.
We could simply fetch this endpoint, and capture the host and ports from it. A rough example below:
I've been using this in my testing to connect to the emulators and it works fine. Just thought I'd post this idea to get your thoughts.
The text was updated successfully, but these errors were encountered: