firebase / firebase/firebase-js-sdk
connect to emulator inconsistencies
- Dominant language
- TypeScript
- Stars
- 5.1k
- Forks
- 1k
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 37
Description
### Operating System
macOS
### Browser Version
Safari 16.5.2
### Firebase SDK Version
10.4.0
### Firebase SDK Product:
Firestore
### Describe your project's tooling
index.html with source tag. Just javascript.
### Describe the problem
Connecting to the different emulators have different syntax. It works one way to connect to the Auth emulator, another to connect to the Firestore emulator. I didn't check the others. But here's an example
```
connectAuthEmulator(auth, "http://127.0.0.1:9099");
connectFirestoreEmulator(db, "127.0.0.1", 8080);
```
The reason this is bad is because, apart from the fact that you have to use a different syntax for no reason and make it unintuitive, it's very easy to mess up and get non-helpful errors on the console. For example, if I try to connect to the Firestore emulator like this
`connectFirestoreEmulator(db, "http://127.0.0.1", 8080);`
I get the following error after a couple of seconds `"Firestore (10.4.0): WebChannelConnection""RPC 'Write' stream 0x1d36fd2c transport errored:"`. It's not actually an error, but any Firestore operation won't work.
All I did was add the `http://` like I do for the auth emulator, and it stopped working.
Please, normalize the method signature to connect to the emulator across all packages.
### Steps and code to reproduce issue
Already explained.
Contributor guide
Assessment
This issue has not been assessed yet.