`stripe-sync-engine` on local database

Does it work with local database? I am trying to use it and have such error:
[Info] { autoExpandLists: false, stripeApiVersion: undefined } StripeSync initialized
[Info] Received webhook evt_1RpoUYGbJRzsapCC7Pl1pgBn: product.updated for product prod_SlLAHtCmsB33kT
[Error] Webhook processing failed: Error: Connection terminated unexpectedly
    at file:///var/tmp/sb-compile-edge-runtime/node_modules/localhost/pg-pool/3.10.1/index.js:45:11
    at eventLoopTick (ext:core/01_core.js:168:7)
    at async Promise.all (index 0)
    at async PostgresClient.upsertMany (file:///var/tmp/sb-compile-edge-runtime/node_modules/localhost/@supabase/stripe-sync-engine/0.39.0/dist/index.js:45:23)
    at async StripeSync.processWebhook (file:///var/tmp/sb-compile-edge-runtime/node_modules/localhost/@supabase/stripe-sync-engine/0.39.0/dist/index.js:747:11)
    at async Object.handler (file:///Users/macbook/photo-x/apps/supabase/functions/stripe-webhook/index.ts:34:5)
    at async respond (ext:sb_core_main_js/js/http.js:197:14)

My code:
import { StripeSync } from 'npm:@supabase/stripe-sync-engine@0.39.0'
import Stripe from 'npm:stripe'
import 'jsr:@supabase/functions-js/edge-runtime.d.ts'

const stripeSecretKey = Deno.env.get('STRIPE_SECRET_KEY') as string
const stripeWebhookSecret = Deno.env.get('STRIPE_WEBHOOK_SECRET') as string
const databaseUrl = Deno.env.get('DATABASE_URL') as string

Deno.serve(async (req) => {
  const stripeSyncConfig = {
    databaseUrl,
    stripeWebhookSecret,
    stripeSecretKey,
    backfillRelatedEntities: false,
    autoExpandLists: false,
    logger: console,
  }
  const stripeSync = new StripeSync(stripeSyncConfig)
  // ...
  try {
    const rawBody = new Uint8Array(await req.arrayBuffer())
    const signature = req.headers.get('stripe-signature')
    await stripeSync.processWebhook(rawBody, signature)
    return new Response('Webhook processed successfully', { status: 200 })
  } //...
})
Was this page helpful?