Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: bind.callback is not a function when receiving broadcast #26913

Closed
churst12 opened this issue May 31, 2024 · 1 comment
Closed

TypeError: bind.callback is not a function when receiving broadcast #26913

churst12 opened this issue May 31, 2024 · 1 comment
Labels
bug Something isn't working needs-analysis Issue status is unknown and/or not possible to triage with the current info realtime Supabase Realtime related

Comments

@churst12
Copy link

Bug report

Describe the bug

When receiving a broadcast, I get a TypeError: bind.callback is not a function.
I can make this error go away(but don't receive the broadcast) if I remove the event name. I have verified that the backend is actually making the broadcast via Realtime dashboard.

To Reproduce

Steps to reproduce the behavior, please provide code snippets or a repository:

  1. Make a broadcast and try to receive it

Page.tsx

const SupabaseClient = createClient(process.env.NEXT_PUBLIC_SUPABASE_API_URL || '', process.env.NEXT_PUBLIC_DATABASE_ANON || '')
...
  useEffect(() => {
    //doesnt work
    const channel = SupabaseClient.channel(game.id, { config: { broadcast: { self: true}}}).on('broadcast', { event: 'test'}).subscribe();
  }, []);

server

const broadCastTableUpdate = (table: string, gameId: string) => {
  const channel = SupabaseClient.channel(gameId);
  channel.subscribe((status: string) => {
    if(status !== 'SUBSCRIBED') {
      return null
    }
     // Send a message once the client is subscribed
    channel.send({
      type: 'broadcast',
      event: 'test',
      payload: { message: 'hello, world' },
    })
  });
};

Expected behavior

Screenshots

asdfasdfasdf

System information

  • OS: Windows
  • Chrome
  • "@supabase/supabase-js": "^2.43.4"
  • Node v20.12.2

Additional context

Add any other context about the problem here.

@churst12 churst12 added the bug Something isn't working label May 31, 2024
@Hallidayo Hallidayo added realtime Supabase Realtime related needs-analysis Issue status is unknown and/or not possible to triage with the current info labels May 31, 2024
@churst12 churst12 closed this as completed Jun 5, 2024
@churst12
Copy link
Author

churst12 commented Jun 5, 2024

I wasn't passing in enough parameters, and I guess I hadn't imported types correctly. Either way, this is a weird error to get in this case

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs-analysis Issue status is unknown and/or not possible to triage with the current info realtime Supabase Realtime related
Projects
None yet
Development

No branches or pull requests

2 participants