😽

Cloudflare D1のマイグレーション時に[code: 7400]エラーが発生する

2024/03/26に公開

現象

wranglerコマンドを用いて、D1のマイグレーションをしようとすると、✘ [ERROR] A request to the Cloudflare API The request is malformed: DBs created during D1's beta do not support backups yet: [code: 7400]エラーが発生する。

$ wrangler d1 migrations apply my-database

Your database may not be available to serve requests during the migration, continue? … yes
🕒 Creating backup...

✘ [ERROR] A request to the Cloudflare API (/accounts/xxxxx/d1/database/xxxxx/backup) failed.

  The request is malformed: DBs created during D1's beta do not support backups yet:
  xxxx-xxxx-xxxx-xxxx-xxxx (v3) [code: 7400]
  
  If you think this is a bug, please open an issue at:
  https://github.com/cloudflare/workers-sdk/issues/new/choose

解決策

単にプロジェクトのwranglerのバージョンが古いからだった。
一旦、wranglerをnpmからアンインストールして入れ直すとマイグレーションは成功した。

$ wrangler -v
 ⛅️ wrangler 2.21.1 (update available 3.37.0)
-------------------------------------------------------

$ npm uninstall wrangler

removed 104 packages, and audited 1 package in 327ms

found 0 vulnerabilities

$ npm install wrangler --save-dev
npm WARN deprecated rollup-plugin-inject@3.0.2: This package has been deprecated and is no longer maintained. Please use @rollup/plugin-inject.
npm WARN deprecated sourcemap-codec@1.4.8: Please use @jridgewell/sourcemap-codec instead

added 73 packages, and audited 74 packages in 8s

11 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

Discussion