Skip to content

firebase serve Error: TIMEOUT: Port 5001 on localhost was not active within 5000ms #7091

Closed

Description

@RaheutRahwana

[REQUIRED] Environment info

firebase-tools: 13.8.0

Platform: Debian GNU/Linux 12

Node: v20.12.0
NPM: 10.5.0

[REQUIRED] Test case

Execute firebase init with Firestore, Function, Hosting and Storage enabled.

[REQUIRED] Steps to reproduce

  1. Open the command line interface (CLI).
  2. Navigate to the root directory of the Firebase project.
  3. Execute the command firebase serve.

[REQUIRED] Expected behavior

The Firebase development server starts successfully within a reasonable time frame.

[REQUIRED] Actual behavior

[info] i  hosting[foo]: Serving hosting files from: public {"metadata":{"emulator":{"name":"hosting"},"message":"Serving hosting files from: \u001b[1mpublic\u001b[22m"}}
[info] ✔  hosting[foo]: Local server: http://localhost:5000 {"metadata":{"emulator":{"name":"hosting"},"message":"Local server: \u001b[4m\u001b[1mhttp://localhost:5000\u001b[22m\u001b[24m"}}
[error] 
[error] Error: TIMEOUT: Port 5001 on localhost was not active within 5000ms

Activity

  1. jacklj commented on May 2, 2024

    @jacklj

    We're having the same issue on CI only, when starting the emulators with firebase emulators:exec:

    TIMEOUT: Port 9000 on 127.0.0.1 was not active within 5000ms
    

    N.B. setting the host in firebase.json explicitly didn't work, as suggested here: #2379 (comment)

  2. aalej commented on May 2, 2024

    @aalej
    Contributor

    Hey folks, thanks for reaching out, sorry to hear you encountered this issue. I’m currently working on replicating this but so far I haven’t encountered any errors with starting the emulators.

    Could anyone share the emulators section of their firebase.json file so that I can try to reproduce this locally? In addition, to help us narrow what could be causing the issue, could you try downgrading to firebase-tools v13.7.5 to see if you’d be able to run the emulators?

  3. jacklj commented on May 2, 2024

    @jacklj

    We've downgraded to 13.7.5 and seems promising so far, just running our test suite again as it could have been a fluke.

    From our firebase.json:

     "emulators": {
        "auth": {
          "port": 9099
        },
        "database": {
          "port": 9000
        },
        "storage": {
          "port": 9199
        },
        "ui": {
          "enabled": true
        }
      }
    

    Thanks for your help @aalej :)

  4. jacklj commented on May 2, 2024

    @jacklj

    We've downgraded to 13.7.5

    Yes that seems to have worked :)

  5. RaheutRahwana commented on May 2, 2024

    @RaheutRahwana
    Author

    @aalej
    Unfortunately, I didn't enable the emulator during firebase init as usual.

  6. RaheutRahwana commented on May 3, 2024

    @RaheutRahwana
    Author

    Dear @aalej @leemhenson

    Upon further investigation, I've encountered a persistent compatibility issue between Firebase Serve and TCP6 in my environment. Specifically, while Firebase Serve listens on TCP6, my environment does not fully support TCP6 connections.

    Before utilizing the -o 0.0.0.0 flag, the netstat -l command revealed the following:

    Active Internet connections (only servers)
    Proto Recv-Q Send-Q Local Address           Foreign Address         State
    tcp6       0      0 localhost:5001          [::]:*                  LISTEN
    tcp6       0      0 localhost:5000          [::]:*                  LISTEN
    

    However, by employing the -o flag and specifying 0.0.0.0, I managed to execute Firebase Serve as a workaround. Nonetheless, it's crucial to acknowledge that this workaround merely masks the issue and does not address the underlying compatibility issue:

    Active Internet connections (only servers)
    Proto Recv-Q Send-Q Local Address           Foreign Address         State
    tcp        0      0 0.0.0.0:5001            0.0.0.0:*               LISTEN
    tcp        0      0 0.0.0.0:5000            0.0.0.0:*               LISTEN
    

    Warm regards.

  7. stanleyillidge commented on May 7, 2024

    @stanleyillidge

    Para mi tambien funciono usar la version npm i -g [email protected] de la CLI, pero tambien tuve que cambiar la variable de sistema JAVA_TOOL_OPTIONS -Xmx10240m

    Thanks for your help @aalej :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions