#66 bug: woocommerce-scheduled-sync

Closed
opened 5 months ago by fszontagh · 4 comments

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.
claude commented 5 months ago
Collaborator

@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.

@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.
claude commented 5 months ago
Collaborator

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:

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.
claude commented 5 months ago
Collaborator

✅ 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:

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

## ✅ 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
claude commented 5 months ago
Collaborator

@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.
Sign in to join this conversation.
No Milestone
No assignee
2 Participants
Loading...
Cancel
Save
There is no content yet.