cloudflare / cloudflare/developer-platform
D1 - Lowercase BEGIN for trigger definition on D1 migration or sql exec fails for remote but not locally
- Dominant language
- No language data
- Stars
- 1
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
### What versions & operating system are you using?
- wrangler 4.42.1
- node v24.9.0
- Ubuntu 24.04.2 LTS (WSL)
### Please provide a link to a minimal reproduction
_No response_
### Describe the Bug
I have a D1 migration `0002_create_triggers.sql` which create some triggers for the updated_at field on some tables. They were working fine locally, but upon running the migration remotely for my test environment the error below happens.
```
✘ [ERROR] incomplete input: SQLITE_ERROR [code: 7500]
```
After checking out some related issues I've tried messing around with my statements and found out that the `BEGIN` statement for my triggers definitions were the issue. I have the habit of writing sql statements in lowercase and have never imagined it would be an issue.
- Migration statement example that works locally but fails remotely:
```
create trigger if not exists update_user_updated_at
after update on user
for each row
begin
update user
set updated_at = current_timestamp
where id = OLD.id;
end;
```
- Migration statement that runs successfully on both local and remote:
```
create trigger if not exists update_user_updated_at
after update on user
for each row
BEGIN
update user
set updated_at = current_timestamp
where id = OLD.id;
end;
```
Tell me if there is any more info that would help debugging.
### Please provide any relevant error logs
```
--- 2025-10-16T20:11:22.611Z log
┌──────────────────────────┬────────┐
│ name │ status │
├──────────────────────────┼────────┤
│ 0002_create_triggers.sql │ ❌ │
└──────────────────────────┴────────┘
---
--- 2025-10-16T20:11:22.666Z error
✘ [ERROR] Migration 0002_create_triggers.sql failed with the following errors:
---
--- 2025-10-16T20:11:22.667Z log
---
--- 2025-10-16T20:11:22.668Z error
✘ [ERROR] incomplete input: SQLITE_ERROR [code: 7500]
---
--- 2025-10-16T20:11:22.678Z debug
Error: incomplete input: SQLITE_ERROR [code: 7500]
at Object.handler (REDACTED/.pnpm/wrangler@4.42.1_@cloudflare+workers-types@4.20251008.0/node_modules/wrangler/wrangler-dist/cli.js:154536:19)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
at async Object.handler (REDACTED/.pnpm/wrangler@4.42.1_@cloudflare+workers-types@4.20251008.0/node_modules/wrangler/wrangler-dist/cli.js:152802:7)
---
--- 2025-10-16T20:11:22.678Z debug
Metrics dispatcher: Posting data {"deviceId":"47c...REDACTED","event":"wrangler command errored","timestamp":1760645482678,"properties":{"amplitude_session_id":1760645479237,"amplitude_event_id":1,"wranglerVersion":"4.42.1","osPlatform":"Linux","osVersion":"#1 SMP PREEMPT_DYNAMIC Thu Jun 5 18:30:46 UTC 2025","nodeVersion":24,"packageManager":"npm","isFirstUsage":false,"configFileType":"jsonc","isCI":false,"isPagesCI":false,"isWorkersCI":false,"isInteractive":true,"hasAssets":true,"argsUsed":["e","env","remote"],"argsCombination":"e, env, remote","command":"wrangler d1 migrations apply","args":{"env":"","e":"","remote":true,"xRemoteBindings":true,"preview":false,"database":""},"durationMs":3458,"durationSeconds":3.458,"durationMinutes":0.057633333333333335,"errorType":"UserError"}}
---
```
Contributor guide
Assessment
This issue has not been assessed yet.