firebase / firebase/firebase-js-sdk

connect to emulator inconsistencies

Open
#7,678 5 comments 1 reaction 0 assignees View on GitHub
api: auth feature request needs-attention testing-sdk
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.