← Back to Dashboard
#9503 D1 import succeeds locally but fails remotely
Recommendation:KEEP OPEN
Difficulty:easy
Reasoning:
Workaround: use PRAGMA foreign_keys = OFF; documentation incorrect
Suggested Action:
Update D1 docs and improve error messages
Analysis Report
Issue Review: cloudflare/workers-sdk#9503
Summary
D1 import succeeds locally but fails remotely with inconsistent, unhelpful errors like {"D1_RESET_DO":true}.
Findings
- Created: 2025-06-06
- Updated: 2025-10-23
- Version: wrangler 4.19.1 → 4.61.0
- Component: wrangler (D1)
- Labels: bug, d1
- Comments: 5
Key Evidence
- Same SQL file works locally but fails remotely with different errors each time
- Error messages are unhelpful:
{"D1_RESET_DO":true}, generic syntax errors - Workaround found by reporter: Use
PRAGMA foreign_keys = OFF;instead ofPRAGMA defer_foreign_keys = on; - Documentation recommends
defer_foreign_keysbut that doesn't work remotely - Local and remote D1 behave differently regarding foreign key pragmas
Recommendation
Status: KEEP OPEN
Reasoning: This reveals a parity issue between local and remote D1 behavior. The workaround exists but the documentation is incorrect and error messages are unhelpful. This should be fixed for better developer experience.
Action: Update D1 documentation to recommend PRAGMA foreign_keys = OFF; for imports. Improve error messages for remote import failures.
Suggested Comment
N/A - Workaround documented in issue comments.
Notes & Feedback (0)
No notes yet.