You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The @opencode-ai/sdk SSE client in serverSentEvents.gen.js calls the global fetch() instead of options.fetch, which means custom fetch implementations are ignored for SSE subscriptions. This blocks usage in containerized environments (like Cloudflare Sandbox) that require custom fetch adapters.
Root Cause: The SDK's client architecture correctly supports custom fetch (client.gen.js:16 merges it, client.gen.js:137-146 passes it to createSseClient), but serverSentEvents.gen.js:20 ignores it.
@kalepail I'm pretty sure OpenCode is using the version with the code you shared, are you sure that's where the issue is? You could also open an issue upstream if it's broken in https://github.com/hey-api/openapi-ts
Any time I've tried to use the events streaming at least with Cloudflare Workers it doesn't work. When I set to consuming events myself with my own interpreter it does. I don't know much about the project but whenever I point any LLM at it they all agree and can confirm by looking at the underlying compiled code that it's using the wrong fetch for event streaming
Same here. We can't subscribe to events through the sdk (from a cloudflare worker/DO) when we are running opencode on a cloudflare sandbox (because @cloudflare/sandbox passes containerFetch which is not honored when using client.event.subscribe)
For now we're working around it by using sandbox.containerFetch directly for the SSE /event endpoint and parsing the stream manually.
Activity
github-actions commentedon Jan 22, 2026
This issue might be a duplicate of existing issues. Please check:
Feel free to ignore if none of these address your specific case.
mrlubos commentedon Jan 24, 2026
@kalepail I'm pretty sure OpenCode is using the version with the code you shared, are you sure that's where the issue is? You could also open an issue upstream if it's broken in https://github.com/hey-api/openapi-ts
kalepail commentedon Jan 26, 2026
Any time I've tried to use the events streaming at least with Cloudflare Workers it doesn't work. When I set to consuming events myself with my own interpreter it does. I don't know much about the project but whenever I point any LLM at it they all agree and can confirm by looking at the underlying compiled code that it's using the wrong
fetchfor event streamingmrlubos commentedon Jan 26, 2026
Do let me know if this is an issue in Hey API, I'd look into it
goleary commentedon Feb 5, 2026
Same here. We can't subscribe to events through the sdk (from a cloudflare worker/DO) when we are running opencode on a cloudflare sandbox (because
@cloudflare/sandboxpasses containerFetch which is not honored when usingclient.event.subscribe)For now we're working around it by using sandbox.containerFetch directly for the SSE /event endpoint and parsing the stream manually.
github-actions commentedon Apr 7, 2026
To stay organized issues are automatically closed after 90 days of no activity. If the issue is still relevant please open a new one.