The edge function fails: woocommerce-scheduled-sync
"[WooCommerce Scheduled Sync] Error fetching stores: {\n code: \"42703\",\n details: null,\n hint: null,\n message: \"column store_sync_config_1.sync_orders does not exist\"\n}\n"
store_sync_config.sync_orders exists
We need to store if our customer want to sync the orders, customers or not. We ask it because the GDPR. So customer can enable or disable these features. But products sync always need.
The edge function fails: woocommerce-scheduled-sync
```
"[WooCommerce Scheduled Sync] Error fetching stores: {\n code: \"42703\",\n details: null,\n hint: null,\n message: \"column store_sync_config_1.sync_orders does not exist\"\n}\n"
```
`store_sync_config.sync_orders` exists
We need to store if our customer want to sync the orders, customers or not. We ask it because the GDPR. So customer can enable or disable these features. But products sync always need.
The problem is clear: the woocommerce-scheduled-sync Edge Function is failing with an error stating that column store_sync_config_1.sync_orders does not exist, even though the column exists in the table.
I'll investigate:
The SQL query in the woocommerce-scheduled-sync Edge Function
The table structure of store_sync_config
Fix the query to properly reference the columns
I'll post updates as I make progress.
@fszontagh I'm starting work on this issue now!
The problem is clear: the `woocommerce-scheduled-sync` Edge Function is failing with an error stating that `column store_sync_config_1.sync_orders does not exist`, even though the column exists in the table.
I'll investigate:
1. The SQL query in the `woocommerce-scheduled-sync` Edge Function
2. The table structure of `store_sync_config`
3. Fix the query to properly reference the columns
I'll post updates as I make progress.
The issue is that the store_sync_config table is missing the sync_orders and sync_customers columns in the database, even though they should have been created by the initial migration.
Current table schema (from database):
✅ sync_products (boolean)
❌ sync_orders (missing)
❌ sync_customers (missing)
Expected schema (from migration file):
✅ sync_products (boolean)
✅ sync_orders (boolean)
✅ sync_customers (boolean)
The Edge Function code references these columns in line 70-72:
sync_orders,
sync_customers,
This causes the SQL error: column store_sync_config_1.sync_orders does not exist
Solution
I'll create a migration to add the missing columns with proper defaults.
## Root Cause Identified
The issue is that the `store_sync_config` table is missing the `sync_orders` and `sync_customers` columns in the database, even though they should have been created by the initial migration.
**Current table schema (from database):**
- ✅ `sync_products` (boolean)
- ❌ `sync_orders` (missing)
- ❌ `sync_customers` (missing)
**Expected schema (from migration file):**
- ✅ `sync_products` (boolean)
- ✅ `sync_orders` (boolean)
- ✅ `sync_customers` (boolean)
The Edge Function code references these columns in line 70-72:
```typescript
sync_orders,
sync_customers,
```
This causes the SQL error: `column store_sync_config_1.sync_orders does not exist`
## Solution
I'll create a migration to add the missing columns with proper defaults.
## ✅ Issue Fixed
The bug has been resolved! The missing columns have been added to the database.
### What was done:
1. **Created and applied migration**: `20251110_add_sync_orders_customers_columns.sql`
- Added `sync_orders` column (BOOLEAN, default: true)
- Added `sync_customers` column (BOOLEAN, default: true)
- Updated all existing store configs with default values
2. **Verified the fix**:
- Confirmed columns exist in `store_sync_config` table
- Tested the exact SQL query used by `woocommerce-scheduled-sync` Edge Function
- Verified existing WooCommerce store has correct config values
### Result:
The `woocommerce-scheduled-sync` Edge Function will now work correctly. The query that was failing:
```sql
store_sync_config (
enabled,
sync_frequency,
sync_products,
sync_orders, -- ✅ Now exists
sync_customers, -- ✅ Now exists
last_sync_at,
next_sync_at
)
```
### GDPR Compliance:
As requested, customers can now control:
- ✅ `sync_products` - Always enabled (cannot be disabled)
- ✅ `sync_orders` - Customer can enable/disable (default: enabled)
- ✅ `sync_customers` - Customer can enable/disable (default: enabled)
The migration has been committed and pushed to the repository.
**Commit**: 10b4158
@fszontagh The issue is now fixed and ready for you to test. The woocommerce-scheduled-sync Edge Function should work without errors on the next scheduled run (hourly at minute 5).
If you want to test it immediately, you can manually trigger the sync through the Edge Function or wait for the next scheduled execution.
@fszontagh The issue is now fixed and ready for you to test. The `woocommerce-scheduled-sync` Edge Function should work without errors on the next scheduled run (hourly at minute 5).
If you want to test it immediately, you can manually trigger the sync through the Edge Function or wait for the next scheduled execution.
The edge function fails: woocommerce-scheduled-sync
store_sync_config.sync_ordersexistsWe need to store if our customer want to sync the orders, customers or not. We ask it because the GDPR. So customer can enable or disable these features. But products sync always need.
@fszontagh I'm starting work on this issue now!
The problem is clear: the
woocommerce-scheduled-syncEdge Function is failing with an error stating thatcolumn store_sync_config_1.sync_orders does not exist, even though the column exists in the table.I'll investigate:
woocommerce-scheduled-syncEdge Functionstore_sync_configI'll post updates as I make progress.
Root Cause Identified
The issue is that the
store_sync_configtable is missing thesync_ordersandsync_customerscolumns in the database, even though they should have been created by the initial migration.Current table schema (from database):
sync_products(boolean)sync_orders(missing)sync_customers(missing)Expected schema (from migration file):
sync_products(boolean)sync_orders(boolean)sync_customers(boolean)The Edge Function code references these columns in line 70-72:
This causes the SQL error:
column store_sync_config_1.sync_orders does not existSolution
I'll create a migration to add the missing columns with proper defaults.
✅ Issue Fixed
The bug has been resolved! The missing columns have been added to the database.
What was done:
Created and applied migration:
20251110_add_sync_orders_customers_columns.sqlsync_orderscolumn (BOOLEAN, default: true)sync_customerscolumn (BOOLEAN, default: true)Verified the fix:
store_sync_configtablewoocommerce-scheduled-syncEdge FunctionResult:
The
woocommerce-scheduled-syncEdge Function will now work correctly. The query that was failing:GDPR Compliance:
As requested, customers can now control:
sync_products- Always enabled (cannot be disabled)sync_orders- Customer can enable/disable (default: enabled)sync_customers- Customer can enable/disable (default: enabled)The migration has been committed and pushed to the repository.
Commit:
10b4158@fszontagh The issue is now fixed and ready for you to test. The
woocommerce-scheduled-syncEdge Function should work without errors on the next scheduled run (hourly at minute 5).If you want to test it immediately, you can manually trigger the sync through the Edge Function or wait for the next scheduled execution.