Skip to content

The SSE endpoint at /admin/channels/whatsapp/auth/stream propagates a normal cancellation as an unhandled System.OperationCanceledException when the client disconnects #47

@geffzhang

Description

@geffzhang

The endpoint passes ctx.RequestAborted directly to subscription.Reader.ReadAllAsync(ct). In this case, the request is a 499 Client Closed Request, meaning the client disconnected first. A deeper issue is that for this request, currentItems.Count == 0 and ctx.Response.HasStarted == false, indicating that the endpoint was waiting silently for new events without starting the response or sending the first SSE frame/heartbeat. Consequently, the connection stays in a “silent wait” state, and when the client cancels, reconnects, navigates away, or times out, RequestAborted is triggered, causing the cancellation exception to be thrown at the await foreach loop. Since the code does not catch this cancellation, the debugger treats it as an unhandled exception.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions