Skip to content

'supabase-js' client's channel.subscribe() always returns state 'CHANNEL_ERROR' #1473

Open
@lht1324

Description

@lht1324

Bug report

  • [✅] I confirm this is a bug with Supabase, not with my own application.
  • [✅] I confirm I have searched the Docs, GitHub Discussions, and Discord.

Describe the bug

I made codes which uses Supabase client's channel by following the docs, but it always return the state 'CHANNEL_ERROR'.

To Reproduce

I couldn't find the exact conditions that cause the error. I'm just guessing that it happens in certain versions greater than 2.50.x.

Expected behavior

this.socket = new this.params.WebSocket(url, undefined);

AI said that 'undefined' makes 'Sec-WebSocket-Protocol: undefined' header, so connection was closed before hand-shaking. Just remove 'undefined' in WebSocket().

Image

This temporary solution worked for me.

Screenshots

If applicable, add screenshots to help explain your problem.

System information

  • OS: Windows 10 Home
  • Browser: chrome
  • Version of @supabase/supabase-js: 2.50.2
  • Version of Node.js: 20.17.57

Additional context

I got this solution from AI, and thought its solution a hallucination, but it worked. AI said that this error is solved in your internal branch, v2.53.1.

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