Bug report
Describe the bug
When creating a StripeSync instance without explicitly setting the schema parameter, subscription-related webhooks processing (such as customer.subscription.created) fail during processing. The issue occurs inside the markDeletedSubscriptionItems() method, where this.config.schema resolves to undefined instead of using the default "stripe" schema.
This leads to PostgreSQL errors like:
relation "undefined.subscription_items" does not exist
To Reproduce
Steps to reproduce the behavior, please provide code snippets or a repository:
- Initialize StripeSync without providing the schema parameter
const stripeSync = new StripeSync({
stripeSecretKey: process.env.STRIPE_SECRET_KEY!,
stripeWebhookSecret: process.env.STRIPE_WEBHOOK_SECRET!,
databaseUrl: process.env.DATABASE_URL!,
// ❌ schema not provided
});
- Run migrations
- Create a webhook handler, for example in Next.js
export async function POST(req: Request) {
const body = await req.text();
const signature = req.headers.get("stripe-signature")!;
try {
await stripeSync.processWebhook(body, signature);
return Response.json({ received: true });
} catch (err) {
console.error("Webhook error:", err);
return new Response("Webhook Error", { status: 400 });
}
}
- Trigger
subcription.customer.created webhook
Expected behavior
When the schema parameter is not provided, subcripition related webhook handlers should default to using the "stripe" schema—just like the other handlers already do.
System information
- OS: macOS
- Version of @supabase/stripe-sync-engine: 0.45.0
Additional context
Same issue was mentioned in this issue
Bug report
Describe the bug
When creating a StripeSync instance without explicitly setting the schema parameter, subscription-related webhooks processing (such as
customer.subscription.created) fail during processing. The issue occurs inside themarkDeletedSubscriptionItems()method, wherethis.config.schemaresolves toundefinedinstead of using the default "stripe" schema.This leads to PostgreSQL errors like:
To Reproduce
Steps to reproduce the behavior, please provide code snippets or a repository:
subcription.customer.createdwebhookExpected behavior
When the schema parameter is not provided, subcripition related webhook handlers should default to using the "stripe" schema—just like the other handlers already do.
System information
Additional context
Same issue was mentioned in this issue