firebase / firebase/firebase-tools

Unable connect to Firestore Emulator from another physical device (able to connect to auth, functions, storage services)

Open
#5,872 7 comments 0 reactions 1 assignee Claimed by @christhompsongoogle View on GitHub
emulator-suite type: bug
Dominant language
TypeScript
Stars
4.5k
Forks
1.3k
Avg merge
1d 12h
Merged PRs (30d)
84

Description

### [REQUIRED] Environment info

**firebase-tools:** 12.1.0

**Platform:** MacOS

### [REQUIRED] Test case

The Firebase Emulator Suite is started on the Mac with host as `0.0.0.0` for all services. An iPhone device is connected to the Mac via USB cable and internet sharing is enabled. Ports of services are `UI: 10100`, `Functions: 10200`, `Auth: 10300`, `Firestore: 10400`.

I'm able to open the Emulator UI in a Safari/Firefox browser by accessing `http://macbook-pro.local:10100` or `http://:10100`, it opens the Auth emulator when clicking on `Go to auth emulator` button and shows list of users. Same with functions and storage emulators. **BUT**, it gives timeout with firestore emulator, and never loads it.

It is a problem, because I'm not being able to test my app. I'm connecting to the Emulator Suite from my app which is running on a physical iPhone device connected to the Mac via USB, and I'm able to log into the app, but I'm not able to get documents from the firestore. On hot restart the user is authenticated, which means the Firebase Auth is able to connect to the emulator, but the Firestore keeps giving `[cloud_firestore/unavailable] The service is currently unavailable. This is a most likely a transient condition and may be corrected by retrying with a backoff` and `[FirebaseFirestore][I-FST000001] WatchStream (10521fe78) Stream error: 'Unavailable: failed to connect to all addresses'` errors.

The app is developed in Flutter, and here is my setup:
```dart
FirebaseFirestore.instance.settings = Settings(
host: 'macbook-pro.local:10400',
sslEnabled: false,
persistenceEnabled: false,
);

FirebaseFirestore.instance.useFirestoreEmulator('macbook-pro.local', 10400);
```

### [REQUIRED] Steps to reproduce

1. Setup a Firebase Emulator Suite.
2. Connect to the host via another device.
3. Open Emulator UI in a browser.
4. Click on the `Go to firestore emulator` button.

### [REQUIRED] Expected behavior

It opens the page with a loading indicator in the collection column saying `Loading collections`, and after few moments it timeouts.

### [REQUIRED] Actual behavior

Should be able to load, similar to Auth, Functions or Storage services.

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.