I'm trying to run firebase emulators:starts
on my project that makes use of Cloud Functions.
It starts the local server at port 5001, if I open it in Chrome I get a { "status": "alive" }
response, but after 30 seconds it shuts down by itself because of a "timeout".
✔ functions: Emulator started at http://localhost:5001
i Shutting down emulators.
i Stopping functions emulator
Error: TIMEOUT: Port 5001 was not active within 30000ms
The project works fine when deployed to Google Cloud, so what's the issue?
I tried to run it with sudo
but it didn't help.
I'm on Windows 10 with WSL (Ubuntu).
firebase emulators:start. The emulators:start command will start emulators for Cloud Functions, Cloud Firestore, Realtime Database, and Firebase Hosting based on the products you have initialized in your local project using firebase init.
In order to use the local emulator, your Cloud Functions must depend on: firebase-admin version 8.0.0 or higher. firebase-functions version 3.0.0 or higher.
The Firebase CLI includes a Cloud Functions emulator which can emulate the following function types: Background functions triggered from Authentication, Realtime Database, Cloud Firestore, and Cloud Pub/Sub. You can run functions locally to test them before deploying to production.
To run the Cloud Functions emulator, use the emulators:start command: The emulators:start command will start emulators for Cloud Functions, Cloud Firestore, Realtime Database, and Firebase Hosting based on the products you have initialized in your local project using firebase init.
As discussed in this comment, setting "host": "127.0.0.1"
in the firebase.json
resolved the issue for me.
{
"firestore": {
"rules": "firestore.rules",
"indexes": "firestore.indexes.json"
},
"emulators": {
"firestore": {
"port": 5000,
"host": "127.0.0.1"
},
"ui": {
"enabled": true
}
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With