From 40ccdf58b21a0a24890cca665da3c758f7d7f2db Mon Sep 17 00:00:00 2001 From: "railway-app[bot]" <68434857+railway-app[bot]@users.noreply.github.com> Date: Tue, 5 May 2026 08:08:20 +0000 Subject: [PATCH] fix: add ws transport for Supabase realtime on Node.js 20 --- examples/merchant-checkout/merchant-server/package.json | 3 ++- examples/merchant-checkout/merchant-server/server.js | 7 ++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/examples/merchant-checkout/merchant-server/package.json b/examples/merchant-checkout/merchant-server/package.json index 096977f..a5c51c7 100644 --- a/examples/merchant-checkout/merchant-server/package.json +++ b/examples/merchant-checkout/merchant-server/package.json @@ -11,6 +11,7 @@ "@autopayprotocol/sdk": "^0.1.5", "@supabase/supabase-js": "^2.95.3", "dotenv": "^17.2.4", - "express": "^4.21.0" + "express": "^4.21.0", + "ws": "^8.18.3" } } diff --git a/examples/merchant-checkout/merchant-server/server.js b/examples/merchant-checkout/merchant-server/server.js index 1a4071e..70dc1c8 100644 --- a/examples/merchant-checkout/merchant-server/server.js +++ b/examples/merchant-checkout/merchant-server/server.js @@ -4,6 +4,7 @@ import { verifyWebhook } from '@autopayprotocol/sdk' import { fileURLToPath } from 'url' import { dirname, join } from 'path' import { createClient } from '@supabase/supabase-js' +import ws from 'ws' const __dirname = dirname(fileURLToPath(import.meta.url)) @@ -30,7 +31,11 @@ const PLAN_IDS = process.env.PLAN_IDS ? process.env.PLAN_IDS.split(',').map(s => // Supabase connection (same DB as relayer, merchant tables) const SUPABASE_URL = process.env.SUPABASE_URL || 'https://jlafnlrurqqalgvxshgz.supabase.co' const SUPABASE_KEY = process.env.SUPABASE_KEY || '' -const supabase = SUPABASE_KEY ? createClient(SUPABASE_URL, SUPABASE_KEY) : null +const supabase = SUPABASE_KEY ? createClient(SUPABASE_URL, SUPABASE_KEY, { + realtime: { + transport: ws, + }, +}) : null const app = express()