Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firebase cloud functions emulator times out after 30000 ms

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).

like image 381
Fez Vrasta Avatar asked Jul 02 '19 11:07

Fez Vrasta


People also ask

What is Firebase emulators start command?

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.

What version of Firebase do I need to run Cloud Functions?

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.

What functions are supported by the firebase CLI?

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.

How do I run a Cloud Functions emulator?

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.


1 Answers

As discussed in this comment, setting "host": "127.0.0.1"in the firebase.json resolved the issue for me.

firebas.json should look sth like this.

{
  "firestore": {
    "rules": "firestore.rules",
    "indexes": "firestore.indexes.json"
  },
  "emulators": {
    "firestore": {
      "port": 5000,
      "host": "127.0.0.1"

    },
    "ui": {
      "enabled": true
    }
  }
}
like image 97
Saif Hakeem Avatar answered Oct 17 '22 08:10

Saif Hakeem