← All tests

Product import — batched (prod)

Narong (2026-06-03): importing Get Coffee's production catalog (~190 products) errored partway.

Gate 2 2/2 passed. Root cause: the whole import ran in ONE server action. Each row fires ~10-15 DB queries; ~99 rows ≈ 1000-1500 subrequests, which exceeds the Cloudflare Worker's per-request budget — the Worker was killed mid-loop and the queued rows never ran (Narong's "an exception ends the pool"). The per-row code was already safe (own transaction + try/catch); the request was just too big. Fix: the client now imports the validated rows in small per-product batches (IMPORT_CHUNK_SIZE = 20, grouped so a product's rows never split), calling runProductImportChunkAction sequentially and aggregating the summary with a live Importing… 40/190 progress count. Each batch is a short request well under the limit. The two Loyverse files (99 + 91 rows) normalize with 0 parse errors and chunk into 5 batches each. Gate 2 on lumiere: a synthetic 45-row file drove 3 batches → 45/45 templates, 0 failures through the deployed UI (then cleaned up). nix-cafe 822ff5b, no migration.
Import result page after a batched import
Deployed import result after the batched run (45 products, 3 batches). Click to zoom.