File tree Expand file tree Collapse file tree 2 files changed +15
-7
lines changed
Expand file tree Collapse file tree 2 files changed +15
-7
lines changed Original file line number Diff line number Diff line change @@ -77,11 +77,9 @@ echo ""
7777echo " 🚀 Step 2: Starting CLI in WebSocket mode..."
7878echo " "
7979
80- # Unset NGROK_AUTH_TOKEN to ensure WebSocket mode
81- unset NGROK_AUTH_TOKEN
82-
8380# Start CLI in background with SKIP_BACKFILL for faster startup
84- cd " $SYNC_ENGINE_DIR " && SKIP_BACKFILL=true node dist/cli/index.js start --database-url " $DATABASE_URL " > /tmp/cli-wss-test.log 2>&1 &
81+ # USE_WEBSOCKET=true forces WebSocket mode even if NGROK_AUTH_TOKEN is present in .env
82+ cd " $SYNC_ENGINE_DIR " && USE_WEBSOCKET=true SKIP_BACKFILL=true node dist/cli/index.js start --database-url " $DATABASE_URL " > /tmp/cli-wss-test.log 2>&1 &
8583CLI_PID=$!
8684
8785# Wait for startup (migrations + WebSocket connection)
@@ -96,13 +94,22 @@ if ! ps -p $CLI_PID > /dev/null 2>&1; then
9694 exit 1
9795fi
9896
97+ # Verify WebSocket mode (must NOT use ngrok)
98+ if grep -q " ngrok tunnel" /tmp/cli-wss-test.log; then
99+ echo " ❌ ERROR: Test is using ngrok when it should use WebSocket mode"
100+ echo " Log output:"
101+ tail -20 /tmp/cli-wss-test.log
102+ exit 1
103+ fi
104+
99105# Check for WebSocket connection in logs
100106if grep -q " Connected to Stripe WebSocket" /tmp/cli-wss-test.log; then
101107 echo " ✓ WebSocket connected successfully"
102108else
103- echo " ⚠️ WebSocket connection status unknown "
109+ echo " ❌ ERROR: WebSocket connection not found in logs "
104110 echo " Log output:"
105111 tail -20 /tmp/cli-wss-test.log
112+ exit 1
106113fi
107114echo " "
108115
Original file line number Diff line number Diff line change @@ -330,8 +330,9 @@ export async function syncCommand(options: CliOptions): Promise<void> {
330330 // Load configuration
331331 const config = await loadConfig ( options )
332332
333- // Determine mode based on ngrok token availability
334- const useWebSocketMode = ! config . ngrokAuthToken
333+ // Determine mode based on USE_WEBSOCKET env var or ngrok token availability
334+ // USE_WEBSOCKET=true explicitly forces WebSocket mode (useful for tests)
335+ const useWebSocketMode = process . env . USE_WEBSOCKET === 'true' || ! config . ngrokAuthToken
335336 const modeLabel = useWebSocketMode ? 'WebSocket' : 'Webhook (ngrok)'
336337 console . log ( chalk . blue ( `\nMode: ${ modeLabel } ` ) )
337338
You can’t perform that action at this time.
0 commit comments