فهرست منبع

fix: resolve 'supabase is not defined' error in sync functions #95

- Fixed shoprenter-sync: changed 'supabase' to 'supabaseAdmin' and 'store_id' to 'storeId'
- Fixed shopify-sync: changed 'store_id' to 'storeId'
- Fixed woocommerce-sync: changed 'store_id' to 'storeId'

All three sync functions had the same variable naming issues when checking access policies.
Claude 5 ماه پیش
والد
کامیت
d2026c1329

+ 1 - 1
supabase/functions/shopify-sync/index.ts

@@ -863,7 +863,7 @@ serve(wrapHandler('shopify-sync', async (req) => {
     const { data: syncConfig } = await supabaseAdmin
       .from('store_sync_config')
       .select('products_access_policy, orders_access_policy, customers_access_policy')
-      .eq('store_id', store_id)
+      .eq('store_id', storeId)
       .single()
 
     // Only sync if policy is 'sync' (not 'api_only' or 'not_allowed')

+ 2 - 2
supabase/functions/shoprenter-sync/index.ts

@@ -765,10 +765,10 @@ serve(wrapHandler('shoprenter-sync', async (req) => {
 
     // Check data access permissions
     // Get access policies from store_sync_config
-    const { data: syncConfig } = await supabase
+    const { data: syncConfig } = await supabaseAdmin
       .from('store_sync_config')
       .select('products_access_policy, orders_access_policy, customers_access_policy')
-      .eq('store_id', store_id)
+      .eq('store_id', storeId)
       .single()
 
     // Only sync if policy is 'sync' (not 'api_only' or 'not_allowed')

+ 1 - 1
supabase/functions/woocommerce-sync/index.ts

@@ -936,7 +936,7 @@ serve(wrapHandler('woocommerce-sync', async (req) => {
       const { data: syncConfig } = await supabaseAdmin
         .from('store_sync_config')
         .select('products_access_policy, orders_access_policy, customers_access_policy')
-        .eq('store_id', store_id)
+        .eq('store_id', storeId)
         .single()
 
       // Only sync if policy is 'sync' (not 'api_only' or 'not_allowed')