Skip to content

Canceling an aborted stream terminates the hono process #248

@KnisterPeter

Description

@KnisterPeter

Hi there,

we have an issue with our application running on node.js using hono.
The error we see in our logs is this one:

AbortError: The operation was aborted
    at destroyer (node:internal/streams/destroy:328:11)
    at Object.cancel (node:internal/webstreams/adapters:500:7)
    at invokePromiseCallback (node:internal/webstreams/util:172:10)
    at Object.cancelAlgorithm (node:internal/webstreams/util:177:23)
    at readableStreamDefaultControllerCancelSteps (node:internal/webstreams/readablestream:2414:37)
    at [kCancel] (node:internal/webstreams/readablestream:1089:12)
    at readableStreamCancel (node:internal/webstreams/readablestream:2018:39)
    at ReadableStream.cancel (node:internal/webstreams/readablestream:324:12)
    at writeFromReadableStream (./node_modules/.pnpm/@[email protected][email protected]/node_modules/@hono/node-server/dist/index.mjs:170:12)
    at responseViaResponseObject (./node_modules/.pnpm/@[email protected][email protected]/node_modules/@hono/node-server/dist/index.mjs:393:15)

After debugging this, I've noticed that the cancel() method of ReadableStream returns a promise.
So what we see here in the stack is a unhandled promise exception.

I will create a bugfix PR for this.

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