Skip to content

Invalid state: ReadableStream is already closed #233

Description

@Plopix

Hello here,
I am starting to suspect something odd in @hono/node-server

We have random ReadableStream is already closed in the app, everything is try/catch but anyway it crashes the container.

We are also using GraphQL Yoga, I found out about this: #77

But I hesitate to do that because GraphQL Yoga is using @whatwg-node/fetch which is supposed to be a good abstraction.

the full trace is:

node:internal/webstreams/readablestream:1162
throw new ERR_INVALID_STATE.TypeError('ReadableStream is already closed');
^
TypeError [ERR_INVALID_STATE]: Invalid state: ReadableStream is already closed
at ReadableByteStreamController.close (node:internal/webstreams/readablestream:1162:13)
at node:internal/deps/undici/undici:1480:28
at node:internal/process/task_queues:151:7
at AsyncResource.runInAsyncScope (node:async_hooks:211:14)
at AsyncResource.runMicrotask (node:internal/process/task_queues:148:8)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5) {
code: 'ERR_INVALID_STATE'
}
Node.js v22.13.1

Of course I don't reproduce easily, it happens randomly

Any idea? to identify the problem better?

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions