Skip to content

firebase emulators:start crashing in nextjs app. #5934

Closed

Description

@kevinnammour

[REQUIRED] Environment info

firebase-tools: 12.3.0

Platform: Windows

[REQUIRED] Test case

[REQUIRED] Steps to reproduce

npx create-next-app@latest .

  • Typescript: Yes
  • Eslint: Yes
  • TailwindCSS: No
  • src directory: No
  • app router: No

firebase init

Choose:

  • Hosting: Configure files for Firebase Hosting and (optionally) set up GitHub Action deploys

  • Emulators: Set up local emulators for Firebase products

  • Detected an existing Next.js codebase in the current directory, should we use this? Yes

  • In which region would you like to host server-side content, if applicable? europe-west1 (Belgium)

  • Set up automatic builds and deploys with GitHub? No

  • Which Firebase emulators do you want to set up? Hosting emulator

  • Which port do you want to use for the hosting emulator? 5000

  • Would you like to enable the Emulator UI? Yes

  • Which port do you want to use for the Emulator UI (leave empty to use any available port)?

  • Would you like to download the emulators now? Yes

firebase emulators:start

Emulator│ Host:Port
Hosting │ 127.0.0.1:5000

[REQUIRED] Expected behavior

The server will stay running once I open 127.0.0.1:5000

[REQUIRED] Actual behavior

Error [ERR_HTTP_HEADERS_SENT]: Cannot render headers after they are sent to the client
Error: An unexpected error has occurred.

  • error uncaughtException: Error [ERR_STREAM_WRITE_AFTER_END]: write after end

And the server crashed.

[debug] [2023-06-04T07:35:29.740Z] Error [ERR_STREAM_WRITE_AFTER_END]: write after end
at new NodeError (node:internal/errors:399:5)
at ServerResponse.end (node:_http_outgoing:1010:15)
at ServerResponse.end (C:\Users\User\Desktop\nextfire\node_modules\next\dist\compiled\compression\index.js:22:783)
at Responder.handleError (C:\Users\User\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\superstatic\lib\responder.js:96:14)
at C:\Users\User\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\superstatic\lib\middleware\files.js:142:29
[error]
[error] Error: An unexpected error has occurred.

Activity

  1. google-oss-bot commented on Jun 4, 2023

    @google-oss-bot
    Collaborator

    This issue does not have all the information required by the template. Looks like you forgot to fill out some sections. Please update the issue with more information.

  2. aalej commented on Jun 5, 2023

    @aalej
    Contributor

    Thanks for reporting this @kevinnammour. I was able to reproduce the error using the steps you provided. I was able to start the emulator, but after accessing 127.0.0.1:5000, it throws an error and the emulator stops running.

    I’ll notify our team about this so that we can investigate this issue. I'll also be marking this as reproducible.

    I am using the following to replicate the issue:

    • firebase-tools: v12.3.0
    • Node: v18.16.0
    • Platform: macOS
  3. alexastrum commented on Jun 14, 2023

    @alexastrum
    Contributor

    We're working on a fix for this issue.
    In the meantime, please use firebase-tools v12.1

  4. leoortizz commented on Jun 27, 2023

    @leoortizz
    Member

    @kevinnammour this issue was fixed by #6005 and will be available in the next release

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