-
-
Notifications
You must be signed in to change notification settings - Fork 74
Description
Bug report
- I confirm this is a bug with Supabase, not with my own application.
- I confirm I have searched the Docs, GitHub Discussions, and Discord.
Describe the bug
The StripeSync engine incorrectly references the schema configuration path when constructing SQL queries. It attempts to access this.config.schema
directly, but the schema is actually nested under this.config.postgresClient.schema
. This causes database queries to fail when trying to sync payment methods and manage subscription items.
To Reproduce
Steps to reproduce the behavior:
import "jsr:@supabase/functions-js/edge-runtime.d.ts";
import { StripeSync } from "npm:@supabase/[email protected]";
// Initialize StripeSync with valid environment variables
const stripeSync = new StripeSync({
databaseUrl,
stripeWebhookSecret,
stripeSecretKey,
backfillRelatedEntities: false,
autoExpandLists: true,
});
// Schema is correctly set in postgresClient config
console.log(
"stripeSync.postgresClient.config.schema:",
stripeSync.postgresClient?.config?.schema,
);
// Attempt to sync payment methods or subscription items
// This will fail with schema reference errors
- Initialize StripeSync with configuration
- Attempt to sync payment methods or manage subscription items
- Observe SQL errors due to incorrect schema path references
- See error: undefined schema in SQL queries
Expected behavior
The StripeSync engine should correctly reference the schema from this.config.postgresClient.schema
instead of this.config.schema
when constructing SQL queries for database operations.
System information
- OS: macOS
- Version of stripe-sync-engine: 0.40.1
- Version of Node.js: N/A (using Deno/Edge Functions)
Additional context
The bug affects three specific locations in stripeSync.ts
:
- Line 743: Payment method sync query
- Line 1132: Subscription items selection query
- Line 1143: Subscription items update query
The fix involves updating these references from this.config.schema
to this.config.postgresClient.schema
to match the actual configuration structure.