Skip to content

TypeError [ERR_INVALID_STATE]: Invalid state: ReadableStream is already closed #55608

Closed
@willianrod

Description

@willianrod

Link to the code that reproduces this issue

https://github.com/willianrod/next-readable-stream-error

To Reproduce

  1. Run the project locally
  2. Go to /auth/login
  3. The app will redirect you to /sample/list after resolving the promise
  4. You should now see the error on your console

Current vs. Expected behavior

Current: Right now, when I'm navigating between pages with server components I'm seeing errors on my development console.
Expected: When navigating between pages no errors should be prompted

Verify canary release

  • I verified that the issue exists in the latest Next.js canary release

Provide environment information

Operating System:
      Platform: darwin
      Arch: arm64
      Version: Darwin Kernel Version 22.5.0: Thu Jun  8 22:22:23 PDT 2023; root:xnu-8796.121.3~7/RELEASE_ARM64_T6020
    Binaries:
      Node: 18.16.0
      npm: 9.5.1
      Yarn: 1.22.19
      pnpm: 8.6.12
    Relevant Packages:
      next: 13.5.1
      eslint-config-next: 13.5.1
      react: 18.2.0
      react-dom: 18.2.0
      typescript: 5.2.2
    Next.js Config:
      output: N/A

Which area(s) are affected? (Select all that apply)

App Router

Additional context

There is a discussion with more people with the same issue. The latest request was to update to the latest version 13.5.1 and see if the issue was still happening.

#55027

Internal error: TypeError [ERR_INVALID_STATE]: Invalid state: ReadableStream is already closed
    at new NodeError (node:internal/errors:399:5)
    at ReadableByteStreamController.enqueue (node:internal/webstreams/readablestream:1150:13)
    at /path/to/app/readable-error/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js:1:447268
    at ut (/path/to/app/readable-error/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js:1:447318)
    at ct (/path/to/app/readable-error/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js:1:446596)
    at Timeout._onTimeout (/path/to/app/readable-error/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js:1:443766)
    at listOnTimeout (node:internal/timers:569:17)
    at process.processTimers (node:internal/timers:512:7

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIssue was opened via the bug report template.locked

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions