cloudflare / cloudflare/developer-platform
D1 Import API becomes unstable after toggling Read Replication
- Dominant language
- No language data
- Stars
- 1
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
### Environment
- Wrangler: reproduced with `4.56.0`, `4.82.2`, and `4.85.0`
- Node.js: `22`
- OS: Linux
- D1 region: APAC
- Command path:
```bash
wrangler d1 execute --remote --file ./d1_file_select_probe.sql --yes
```
The SQL file is tiny, for example:
```sql
SELECT 5;
```
### Bug
After enabling or disabling D1 Read Replication, `wrangler d1 execute --remote --file` becomes unstable even for tiny SQL files.
This command uses the D1 Import API (`/import`), not the normal query API (`/query`). The same database can still run small SQL through `--command`, which uses `/query`.
The failure appears to affect the new import/upload path. When the same file is retried and Wrangler prints:
```text
File already uploaded. Processing.
```
that cached-etag path is not affected and still succeeds. Therefore, a successful retry with the same file does not prove that the fresh upload/init path has recovered.
### Actual Results
| UTC time | DB | Import stage | Result |
|---|---|---|---|
| 2026-04-26T10:54:49Z | main DB | first `/import` request | 60s later: 504 / 7009 |
| 2026-04-26T11:08:12Z | main DB | first `/import` request | 60s later: 504 / 7009 |
| 2026-04-26T11:17:52Z | main DB | first `/import` returned 200, second `/import` timed out | 504 / 7009 |
| 2026-04-26T11:21:19Z | probe DB | two `/import` requests returned 200 | Import API body error: `Network connection lost.` |
Example errors:
```text
Upstream service unavailable [code: 7009]
```
```text
✘ [ERROR] Network connection lost.
```
### Expected
`wrangler d1 execute --remote --file` should reliably process tiny SQL files, or return a clear actionable error if D1 Import API is incompatible with recent Read Replication state changes.
### Notes
This does not look like a SQL size/content issue. The failing files contain only `SELECT N;`.
I searched existing public issues/discussions and did not find the same Read Replication + D1 Import API report.
Could the D1 team confirm whether Import API has any known interaction with Read Replication enable/disable transitions?
I can provide private details if needed:
- account ID
- database IDs
- exact UTC timestamps
- sanitized Wrangler debug logs
Contributor guide
Assessment
This issue has not been assessed yet.