cloudflare / cloudflare/developer-platform

๐Ÿ› BUG: `504 Gateway Time-out` when applying migrations in D1

ใ‚ชใƒผใƒ—ใƒณ
#4 ใ‚ณใƒกใƒณใƒˆ 19 ไปถ ใƒชใ‚ขใ‚ฏใ‚ทใƒงใƒณ 1 ไปถ ๆ‹…ๅฝ“่€… 1 ๅ @lambrospetrou ใŒๆ‹…ๅฝ“ใ‚’ๅธŒๆœ›ใ—ใฆใ„ใพใ™ GitHub ใง่ฆ‹ใ‚‹
awaiting-response:cloudflare needs-reproduction product:d1
ไธป่ฆ่จ€่ชž
่จ€่ชžใฎใƒ‡ใƒผใ‚ฟใŒใ‚ใ‚Šใพใ›ใ‚“
ใ‚นใ‚ฟใƒผ
1
ใƒ•ใ‚ฉใƒผใ‚ฏ
0
PR ใƒžใƒผใ‚ธๆŒ‡ๆจ™
30ๆ—ฅไปฅๅ†…ใซใƒžใƒผใ‚ธใ•ใ‚ŒใŸ PR ใฏใ‚ใ‚Šใพใ›ใ‚“

่ชฌๆ˜Ž

### Which Cloudflare product(s) does this pertain to?

D1

### What versions are you using?

3.102.0 [Wrangler], 20.18.0 [Node.js]

### What operating system and version are you using?

Mac Sequoia 15.2

### Please provide a link to a minimal reproduction

_No response_

### Describe the Bug

I get the following error message when I apply a migration:

```
โœ˜ [ERROR] Migration 0043_cultured_the_stranger.sql failed with the following errors:



โœ˜ [ERROR]


504 Gateway Time-out

504 Gateway Time-out/query -> 504 Gateway Time-out
```

The migration SQL commands:

```sql
ALTER TABLE `app_devices` DROP COLUMN `force_app_bundle_id`;
ALTER TABLE `app_devices` DROP COLUMN `force_app_channel_id`;
```

### Please provide any relevant error logs

Wrangler Logs

```
--- 2025-01-15T14:25:18.408Z debug
๐Ÿชต Writing logs to "/Users/robingenz/Library/Preferences/.wrangler/logs/wrangler-2025-01-15_14-25-18_336.log"
---

--- 2025-01-15T14:25:18.408Z debug
Metrics dispatcher: Dispatching disabled - would have sent {"deviceId":"","event":"wrangler command started","timestamp":1736951118408,"properties":{"amplitude_session_id":1736951118407,"amplitude_event_id":0,"wranglerVersion":"3.102.0","osPlatform":"Mac OS","osVersion":"Darwin Kernel Version 24.2.0: Fri Dec 6 19:01:59 PST 2024; root:xnu-11215.61.5~2/RELEASE_ARM64_T6000","nodeVersion":20,"packageManager":"npm","isFirstUsage":false,"configFileType":"toml","isCI":false,"isPagesCI":false,"isWorkersCI":false,"isInteractive":true,"hasAssets":false,"argsUsed":["remote"],"argsCombination":"remote","command":"wrangler d1 migrations apply","args":{"remote":true,"xJsonConfig":true,"j":true,"preview":false,"database":""}}}.
---

--- 2025-01-15T14:25:18.410Z debug
.env file not found at ".env". Continuing... For more details, refer to https://developers.cloudflare.com/workers/wrangler/system-environment-variables/
---

--- 2025-01-15T14:25:18.413Z debug
No experimental flag store instantiated
---

--- 2025-01-15T14:25:18.413Z debug
Attempted to use flag "RESOURCES_PROVISION" which has not been instantiated
---

--- 2025-01-15T14:25:18.413Z debug
No experimental flag store instantiated
---

--- 2025-01-15T14:25:18.413Z debug
Attempted to use flag "RESOURCES_PROVISION" which has not been instantiated
---

--- 2025-01-15T14:25:18.436Z warn
โ–ฒ [WARNING] Processing wrangler.toml configuration:

- "unsafe" fields are experimental and may change or break at any time.

---

--- 2025-01-15T14:25:20.687Z log

โ›…๏ธ wrangler 3.102.0
--------------------

---

--- 2025-01-15T14:25:20.688Z debug
Checking if domain has Access enabled: dash.cloudflare.com
---

--- 2025-01-15T14:25:20.688Z debug
Access switch not cached for: dash.cloudflare.com
---

--- 2025-01-15T14:25:20.796Z debug
Caching access switch for: dash.cloudflare.com
---

--- 2025-01-15T14:25:21.361Z log
๐ŸŒ€ Executing on preview database ():
---

--- 2025-01-15T14:25:21.361Z log
๐ŸŒ€ To execute on your local development database, remove the --remote flag from your wrangler command.
---

--- 2025-01-15T14:25:21.362Z debug
-- START CF API REQUEST: POST https://api.cloudflare.com/client/v4/accounts//d1/database//query
---

--- 2025-01-15T14:25:21.362Z debug
HEADERS: omitted; set WRANGLER_LOG_SANITIZE=false to include sanitized data
---

--- 2025-01-15T14:25:21.362Z debug
INIT: omitted; set WRANGLER_LOG_SANITIZE=false to include sanitized data
---

--- 2025-01-15T14:25:21.362Z debug
-- END CF API REQUEST
---

--- 2025-01-15T14:25:24.311Z debug
-- START CF API RESPONSE: OK 200
---

--- 2025-01-15T14:25:24.312Z debug
HEADERS: omitted; set WRANGLER_LOG_SANITIZE=false to include sanitized data
---

--- 2025-01-15T14:25:24.312Z debug
RESPONSE: omitted; set WRANGLER_LOG_SANITIZE=false to include sanitized data
---

--- 2025-01-15T14:25:24.312Z debug
-- END CF API RESPONSE
---

--- 2025-01-15T14:25:24.312Z log
๐Ÿšฃ Executed 1 command in 0.2813ms
---

--- 2025-01-15T14:25:24.312Z log
๐ŸŒ€ Executing on preview database ():
---

--- 2025-01-15T14:25:24.312Z log
๐ŸŒ€ To execute on your local development database, remove the --remote flag from your wrangler command.
---

--- 2025-01-15T14:25:24.312Z debug
-- START CF API REQUEST: POST https://api.cloudflare.com/client/v4/accounts//d1/database//query
---

--- 2025-01-15T14:25:24.312Z debug
HEADERS: omitted; set WRANGLER_LOG_SANITIZE=false to include sanitized data
---

--- 2025-01-15T14:25:24.313Z debug
INIT: omitted; set WRANGLER_LOG_SANITIZE=false to include sanitized data
---

--- 2025-01-15T14:25:24.313Z debug
-- END CF API REQUEST
---

--- 2025-01-15T14:25:25.985Z debug
-- START CF API RESPONSE: OK 200
---

--- 2025-01-15T14:25:25.986Z debug
HEADERS: omitted; set WRANGLER_LOG_SANITIZE=false to include sanitized data
---

--- 2025-01-15T14:25:25.986Z debug
RESPONSE: omitted; set WRANGLER_LOG_SANITIZE=false to include sanitized data
---

--- 2025-01-15T14:25:25.986Z debug
-- END CF API RESPONSE
---

--- 2025-01-15T14:25:25.986Z log
๐Ÿšฃ Executed 1 command in 0.6588ms
---

--- 2025-01-15T14:25:25.989Z log
Migrations to be applied:
---

--- 2025-01-15T14:25:25.998Z log
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ name โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ 0043_cultured_the_stranger.sql โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
---

--- 2025-01-15T14:25:35.114Z debug
-- START CF API REQUEST: GET https://api.cloudflare.com/client/v4/accounts//d1/database/
---

--- 2025-01-15T14:25:35.114Z debug
HEADERS: omitted; set WRANGLER_LOG_SANITIZE=false to include sanitized data
---

--- 2025-01-15T14:25:35.114Z debug
INIT: omitted; set WRANGLER_LOG_SANITIZE=false to include sanitized data
---

--- 2025-01-15T14:25:35.114Z debug
-- END CF API REQUEST
---

--- 2025-01-15T14:25:36.932Z debug
-- START CF API RESPONSE: OK 200
---

--- 2025-01-15T14:25:36.932Z debug
HEADERS: omitted; set WRANGLER_LOG_SANITIZE=false to include sanitized data
---

--- 2025-01-15T14:25:36.932Z debug
RESPONSE: omitted; set WRANGLER_LOG_SANITIZE=false to include sanitized data
---

--- 2025-01-15T14:25:36.932Z debug
-- END CF API RESPONSE
---

--- 2025-01-15T14:25:36.934Z log
๐ŸŒ€ Executing on preview database ():
---

--- 2025-01-15T14:25:36.934Z log
๐ŸŒ€ To execute on your local development database, remove the --remote flag from your wrangler command.
---

--- 2025-01-15T14:25:36.934Z debug
-- START CF API REQUEST: POST https://api.cloudflare.com/client/v4/accounts//d1/database//query
---

--- 2025-01-15T14:25:36.934Z debug
HEADERS: omitted; set WRANGLER_LOG_SANITIZE=false to include sanitized data
---

--- 2025-01-15T14:25:36.934Z debug
INIT: omitted; set WRANGLER_LOG_SANITIZE=false to include sanitized data
---

--- 2025-01-15T14:25:36.934Z debug
-- END CF API REQUEST
---
```

ใ‚ณใƒณใƒˆใƒชใƒ“ใƒฅใƒผใ‚ทใƒงใƒณใ‚ฌใ‚คใƒ‰

ใ‚ณใƒณใƒˆใƒชใƒ“ใƒฅใƒผใ‚ทใƒงใƒณใ‚ฌใ‚คใƒ‰ใ‚’้–‹ใ

่ฉ•ไพก

ใ“ใฎ issue ใฏใพใ ่ฉ•ไพกใ•ใ‚Œใฆใ„ใพใ›ใ‚“ใ€‚

ๆ–ฐใ—ใ„ issue ใ‚’ใƒกใƒผใƒซใงๅ—ใ‘ๅ–ใ‚‹

ๅˆๅฟƒ่€…ๅ‘ใ‘ใฎ GitHub issue ใ‚’็Ÿญใใพใจใ‚ใŸใƒ€ใ‚คใ‚ธใ‚งใ‚นใƒˆใ€‚