Skip to content

Commit e4f2f8c

Browse files
author
georgiy.rusanov
committed
more logs
1 parent f12458e commit e4f2f8c

File tree

3 files changed

+25
-15
lines changed

3 files changed

+25
-15
lines changed

.github/workflows/ci.yml

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -125,12 +125,17 @@ jobs:
125125
run: |
126126
echo "Checking HTTP endpoint with curl..."
127127
curl -v http://127.0.0.1:54321 || echo "curl failed"
128-
129-
npm install -g wscat
130-
128+
131129
echo "Testing WebSocket connection to supabase realtime..."
132-
timeout 5 wscat -c ws://127.0.0.1:54321/realtime/v1/websocket || echo "WS connection failed or timed out"
133-
130+
# Test WebSocket connection using curl (which supports WebSocket)
131+
curl -i -N -H "Connection: Upgrade" -H "Upgrade: websocket" -H "Sec-WebSocket-Version: 13" -H "Sec-WebSocket-Key: x3JJHMbDL1EzLkh9GBhXDw==" http://127.0.0.1:54321/realtime/v1/websocket || echo "WS connection failed"
132+
133+
echo "Testing realtime endpoint directly..."
134+
curl -v http://127.0.0.1:54321/realtime/v1/ || echo "Realtime endpoint failed"
135+
136+
echo "Testing realtime health check..."
137+
curl -v http://127.0.0.1:54321/realtime/v1/api/ping || echo "Realtime ping failed"
138+
134139
docker ps --format '{{.Names}}'
135140
136141
echo "docker logs"
@@ -139,6 +144,9 @@ jobs:
139144
docker logs --tail 20 $name || echo "No logs for $name"
140145
done
141146
147+
echo "Checking realtime container specifically..."
148+
docker logs supabase_realtime_supabase-js --tail 50 || echo "No realtime logs"
149+
142150
- name: Build and test expo
143151
run: |
144152
npm clean-install

examples/expo-app/__tests__/Index.test.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ describe('Index', () => {
77
})
88

99
it('should display SUBSCRIBED status when realtime connection is established', async () => {
10+
console.log('Starting realtime connection test...')
1011
const { getByTestId, unmount } = render(<Index />)
1112

1213
// Initially, the text should be empty
@@ -16,21 +17,24 @@ describe('Index', () => {
1617
await waitFor(
1718
() => {
1819
const status = getByTestId('realtime_status').props.children
20+
console.log('Current realtime status:', status)
1921
expect(status).toBe('SUBSCRIBED')
2022
},
2123
{
22-
timeout: 30000, // 30 seconds timeout for waitFor
24+
timeout: 60000, // 60 seconds timeout for waitFor (increased for CI)
2325
interval: 1000, // Check every second
2426
onTimeout: (error) => {
2527
const currentStatus = getByTestId('realtime_status').props.children
28+
console.error('Test timeout. Current status:', currentStatus)
2629
throw new Error(
2730
`Timeout waiting for SUBSCRIBED status. Current status: ${currentStatus}. ${error.message}`
2831
)
2932
},
3033
}
3134
)
3235

36+
console.log('Test completed successfully')
3337
// Unmount the component to trigger cleanup.
3438
unmount()
35-
}, 35000) // 35 seconds timeout for the entire test
39+
}, 70000) // 70 seconds timeout for the entire test (increased for CI)
3640
})

examples/expo-app/app/index.tsx

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,17 @@ export default function Index() {
1212
const [realtimeStatus, setRealtimeStatus] = useState<string | null>(null)
1313

1414
useEffect(() => {
15+
console.log('Setting up realtime connection...')
1516
const channel = supabase.channel('realtime:public:todos')
16-
17-
channel.on('error', (error) => {
18-
console.error('Realtime channel error:', error)
19-
})
20-
17+
2118
channel.subscribe((status) => {
2219
console.log('Realtime status:', status)
23-
if (status === 'SUBSCRIBED') {
24-
setRealtimeStatus(status)
25-
}
20+
// Show all statuses, not just SUBSCRIBED
21+
setRealtimeStatus(status)
2622
})
23+
2724
return () => {
25+
console.log('Cleaning up realtime connection...')
2826
channel.unsubscribe()
2927
supabase.realtime.disconnect()
3028
}

0 commit comments

Comments
 (0)