Skip to content

Commit 24e5e84

Browse files
authored
fix: use setAuth for realtime in signup flows also (#1551)
* fix: use setAuth for realtime in signup flows also * fix ci * push token instead of using binded expression
1 parent 4d7e616 commit 24e5e84

File tree

9 files changed

+208
-128
lines changed

9 files changed

+208
-128
lines changed

.github/workflows/ci.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,14 @@ jobs:
316316
- name: Start Supabase
317317
run: supabase start
318318

319+
- name: Create storage bucket for tests
320+
run: |
321+
SERVICE_ROLE_KEY="$(supabase status --output json | jq -r '.SERVICE_ROLE_KEY')"
322+
curl -X POST 'http://127.0.0.1:54321/storage/v1/bucket' \
323+
-H "Authorization: Bearer $SERVICE_ROLE_KEY" \
324+
-H 'Content-Type: application/json' \
325+
-d '{"id": "test-bucket", "name": "test-bucket", "public": true}'
326+
319327
- name: Install dependencies and run tests
320328
run: |
321329
cd test/integration/bun

package-lock.json

Lines changed: 57 additions & 32 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/SupabaseClient.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,7 @@ export default class SupabaseClient<
371371
this.changedAccessToken !== token
372372
) {
373373
this.changedAccessToken = token
374+
this.realtime.setAuth(token)
374375
} else if (event === 'SIGNED_OUT') {
375376
this.realtime.setAuth()
376377
if (source == 'STORAGE') this.auth.signOut()

supabase/.temp/cli-latest

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v2.33.9
1+
v2.40.7

test/deno/integration.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,6 @@ Deno.test(
156156
await supabase.auth.signUp({ email, password })
157157
const config = { broadcast: { self: true }, private: true }
158158
channel = supabase.channel(channelName, { config })
159-
await supabase.realtime.setAuth()
160159

161160
const testMessage = { message: 'test' }
162161
let receivedMessage: any

test/integration.test.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -278,8 +278,6 @@ describe('Supabase Integration Tests', () => {
278278

279279
const config = { broadcast: { self: true }, private: true }
280280
channel = supabase.channel(channelName, { config })
281-
282-
await supabase.realtime.setAuth()
283281
})
284282

285283
afterEach(async () => {

test/integration/bun/bun.lockb

7.52 KB
Binary file not shown.

test/integration/bun/integration.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ test('should subscribe to realtime channel', async () => {
1414
const email = `bun-test-${Date.now()}@example.com`
1515
const password = 'password123'
1616
await supabase.auth.signUp({ email, password })
17-
await supabase.realtime.setAuth()
1817

1918
const channelName = `bun-channel-${crypto.randomUUID()}`
2019
const config = { broadcast: { self: true }, private: true }

0 commit comments

Comments
 (0)