Skip to content

Conversation

Maharshi2403
Copy link

@Maharshi2403 Maharshi2403 commented Sep 23, 2025

  • Avoid sending empty Authorization header when no session exists
  • Use global.headers.Authorization or supabaseKey as fallback
  • Fixes 500 error on /realtime/v1/api/broadcast
  • Closes #38820

Issue: When calling channel.send() without channel.subscribe(), the Realtime client falls back to /realtime/v1/api/broadcast. Without a session, it sends an empty Authorization: \r\n header, causing a 500 error.

Fix: Updated _getAccessToken to:

  • Check for a valid session before returning an access token.
  • Use global.headers.Authorization or supabaseKey if no session exists.
  • Prevents empty Authorization header in REST requests.

Repro: See issue #38820

  • Before: send ok? timed out (500 error).
  • After: send ok? ok with correct headers.

Tests: Verified with local repro and existing test suite.

- Avoid sending empty Authorization header when no session exists
- Use global.headers.Authorization or supabaseKey as fallback
- Fixes 500 error on /realtime/v1/api/broadcast
- Closes #38820
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