はじめに
GitHub Actionsを使ってCDパイプラインを作成し、Cloudflareにデプロイしようとしたところエラーが発生しました。
問題
deploy: could not read the pending D1 migrations for "my-app" before
applying them (exit 1). Refusing to migrate without knowing whether a restore
point is needed. Rerun once Cloudflare can be reached.
Cloudflare: ┌ APIError
│ [code: 7403] The given account is not valid or is not authorized to access
this service
解決方法
APIトークンのpermissionにD1のwrite権限を追加する
おわりに
D1も使用するアプリだったのでworkersだけでなくD1の権限も必要でした。
