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
createOpencodeClient({ fetch }) allows passing a custom fetch implementation for authentication (e.g., Basic Auth, Bearer tokens, or custom headers). While the standard API endpoints honor this setting, the SSE client used for events (client.event.subscribe()) was hard-coded to use the global fetch.
This causes SSE connections to fail with 401 Unauthorized errors when the server is protected, leading to a silent reconnection loop.
Closing as duplicate of #10077. This concerns the legacy OpenCode JavaScript SDK event SSE client rather than authentication to an MCP server. The generated SDK v2 path respects the configured custom fetch, which is the recommended workaround/current path.
Activity
github-actions commentedon May 18, 2026
This issue might be a duplicate of an existing issue. Please check:
client.event.subscribe()uses globalfetch()instead of the custom fetch passed tocreateOpencodeClient, causing auth failures.nexxeln commentedon May 18, 2026
you can use
@opencode-ai/sdk/v2for now as a workaround, that path already respects customfetch.rekram1-node commentedon Jun 24, 2026
Closing as duplicate of #10077. This concerns the legacy OpenCode JavaScript SDK event SSE client rather than authentication to an MCP server. The generated SDK v2 path respects the configured custom
fetch, which is the recommended workaround/current path.