Skip to content

fix: handle cancelled SSE streams - #34

Open
noamkush wants to merge 1 commit into
ephraimduncan:mainfrom
noamkush:fix/sse-cancellation
Open

fix: handle cancelled SSE streams#34
noamkush wants to merge 1 commit into
ephraimduncan:mainfrom
noamkush:fix/sse-cancellation

Conversation

@noamkush

@noamkush noamkush commented Aug 3, 2026

Copy link
Copy Markdown

This fixes an issue I had using the plugin, have been getting this error:

1007 |             const encoder = new TextEncoder();
1008 |             let closed = false;
1009 |             const sendSSE = (data) => {
1010 |                 if (closed)
1011 |                     return;
1012 |                 controller.enqueue(encoder.encode(`data: ${JSON.stringify(data)}\n\n`));
                 ^
TypeError: Invalid state: Controller is already closed
 code: "ERR_INVALID_STATE"

      at sendSSE (/home/noam/.cache/opencode/packages/opencode-cursor-oauth@latest/node_modules/opencode-cursor-oauth/dist/proxy.js:1012:28)
      at <anonymous> (/home/noam/.cache/opencode/packages/opencode-cursor-oauth@latest/node_modules/opencode-cursor-oauth/dist/proxy.js:1150:21)
      at <anonymous> (/home/noam/.cache/opencode/packages/opencode-cursor-oauth@latest/node_modules/opencode-cursor-oauth/dist/proxy.js:173:13)

I used an LLM to fix the issue. While I am not very familiar with typescript, the fix looks reasonable to me, and the issue did not persist after making the change.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant