@@ -121,135 +121,8 @@ jobs:
121121 run : |
122122 supabase start
123123
124- - name : Debug Supabase connectivity
125- run : |
126- echo "Checking HTTP endpoint with curl"
127- curl -v http://127.0.0.1:54321 || echo "curl failed"
128-
129- echo "Testing WebSocket connection to supabase realtime with auth"
130- # Test WebSocket connection with proper authentication parameters
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?apikey=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24iLCJleHAiOjE5ODM4MTI5OTZ9.CRXP1A7WOeoJeXxjNni43kdQwgnWNReilDMblYTn_I0&vsn=1.0.0" || echo "WS connection failed"
132-
133- echo "Testing direct WebSocket connection to realtime service (bypassing Kong)"
134- # Test direct connection to realtime service on port 4000
135- curl -i -N -H "Connection: Upgrade" -H "Upgrade: websocket" -H "Sec-WebSocket-Version: 13" -H "Sec-WebSocket-Key: x3JJHMbDL1EzLkh9GBhXDw==" "http://127.0.0.1:4000/socket/websocket?apikey=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24iLCJleHAiOjE5ODM4MTI5OTZ9.CRXP1A7WOeoJeXxjNni43kdQwgnWNReilDMblYTn_I0&vsn=1.0.0" || echo "Direct WS connection failed"
136-
137- echo "Testing realtime endpoint directly"
138- curl -v http://127.0.0.1:54321/realtime/v1/ || echo "Realtime endpoint failed"
139-
140- echo "Testing realtime health check"
141- curl -v http://127.0.0.1:54321/realtime/v1/api/ping || echo "Realtime ping failed"
142-
143- echo "Testing realtime health check with auth"
144- curl -v -H "apikey: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24iLCJleHAiOjE5ODM4MTI5OTZ9.CRXP1A7WOeoJeXxjNni43kdQwgnWNReilDMblYTn_I0" http://127.0.0.1:54321/realtime/v1/api/ping || echo "Realtime ping with auth failed"
145-
146- echo "Testing realtime subscription endpoint"
147- curl -v -X POST -H "Content-Type: application/json" -H "apikey: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24iLCJleHAiOjE5ODM4MTI5OTZ9.CRXP1A7WOeoJeXxjNni43kdQwgnWNReilDMblYTn_I0" -d '{"channel":"test-channel","type":"broadcast"}' http://127.0.0.1:54321/realtime/v1/api/broadcast || echo "Realtime broadcast failed"
148-
149- echo "Testing direct realtime service endpoints"
150- curl -v http://127.0.0.1:4000/api/ping || echo "Direct realtime ping failed"
151- curl -v -H "apikey: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24iLCJleHAiOjE5ODM4MTI5OTZ9.CRXP1A7WOeoJeXxjNni43kdQwgnWNReilDMblYTn_I0" http://127.0.0.1:4000/api/ping || echo "Direct realtime ping with auth failed"
152-
153- echo "Testing WebSocket connection with Node.js"
154- npm install ws || echo "Failed to install ws package"
155- node -e "
156- const WebSocket = require('ws');
157- const ws = new WebSocket('ws://127.0.0.1:54321/realtime/v1/websocket?apikey=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24iLCJleHAiOjE5ODM4MTI5OTZ9.CRXP1A7WOeoJeXxjNni43kdQwgnWNReilDMblYTn_I0&vsn=1.0.0');
158-
159- ws.on('open', () => {
160- console.log('WebSocket connection opened');
161- // Send a phx_join message
162- const joinMessage = JSON.stringify({
163- topic: 'realtime:test-channel',
164- event: 'phx_join',
165- payload: {
166- config: { broadcast: { self: false }, presence: { key: '' }, private: false },
167- access_token: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24iLCJleHAiOjE5ODM4MTI5OTZ9.CRXP1A7WOeoJeXxjNni43kdQwgnWNReilDMblYTn_I0'
168- },
169- ref: '1'
170- });
171- console.log('Sending join message with full payload:');
172- console.log(JSON.stringify(JSON.parse(joinMessage), null, 2));
173- ws.send(joinMessage);
174- });
175-
176- ws.on('message', (data) => {
177- console.log('Received message:', data.toString());
178- try {
179- const parsed = JSON.parse(data.toString());
180- console.log('Parsed message:', JSON.stringify(parsed, null, 2));
181- } catch (e) {
182- console.log('Could not parse message as JSON');
183- }
184- });
185-
186- ws.on('error', (error) => {
187- console.log('WebSocket error:', error.message);
188- });
189-
190- ws.on('close', (code, reason) => {
191- console.log('WebSocket closed:', code, reason.toString());
192- });
193-
194- setTimeout(() => {
195- console.log('Closing WebSocket connection');
196- ws.close();
197- }, 5000);
198- " || echo "Node.js WebSocket test failed"
199-
200- echo "Testing JWT token validation"
201- node -e "
202- const jwt = require('jsonwebtoken');
203-
204- const token = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24iLCJleHAiOjE5ODM4MTI5OTZ9.CRXP1A7WOeoJeXxjNni43kdQwgnWNReilDMblYTn_I0';
205- const secret = 'super-secret-jwt-token-with-at-least-32-characters-long';
206-
207- try {
208- const decoded = jwt.verify(token, secret);
209- console.log('JWT token is valid');
210- console.log('Decoded payload:', JSON.stringify(decoded, null, 2));
211- } catch (error) {
212- console.log('JWT token validation failed:', error.message);
213- }
214- " || echo "JWT validation test failed"
215-
216- docker ps --format '{{.Names}}'
217-
218- echo "docker logs"
219- for name in $(docker ps --format '{{.Names}}'); do
220- echo "Logs for $name:"
221- docker logs --tail 20 $name || echo "No logs for $name"
222- done
223-
224- echo "Checking realtime container specifically"
225- docker logs supabase_realtime_supabase-js --tail 50 || echo "No realtime logs"
226-
227- echo "Checking Kong logs for WebSocket requests"
228- docker logs supabase_kong_supabase-js --tail 20 || echo "No Kong logs"
229-
230- echo "Checking if realtime service is properly configured"
231- docker exec supabase_realtime_supabase-js env | grep -E "(REALTIME|POSTGRES|JWT)" || echo "No realtime env vars found"
232-
233124 - name : Build and test expo
234- env :
235- SUPABASE_URL : http://127.0.0.1:54321
236- SUPABASE_ANON_KEY : eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24iLCJleHAiOjE5ODM4MTI5OTZ9.CRXP1A7WOeoJeXxjNni43kdQwgnWNReilDMblYTn_I0
237125 run : |
238- echo "Waiting for realtime service to be fully initialized"
239- sleep 30
240-
241- echo "Checking realtime service health..."
242- for i in {1..10}; do
243- if curl -s http://127.0.0.1:54321/realtime/v1/api/ping | grep -q "Success"; then
244- echo "Realtime service is healthy"
245- break
246- else
247- echo "Waiting for realtime service to be ready... (attempt $i/10)"
248- sleep 5
249- fi
250- done
251-
252- echo "Running Expo app test with environment variables"
253126 npm clean-install
254127 npm run build
255128 PKG=$(npm pack)
0 commit comments