Skip to content

[wrangler] Preserve D1 migration paths during redirected provisioning - #15517

Draft
xgame92 wants to merge 1 commit into
cloudflare:mainfrom
xgame92:xgame92/fix-vite-d1-migrations-path
Draft

[wrangler] Preserve D1 migration paths during redirected provisioning#15517
xgame92 wants to merge 1 commit into
cloudflare:mainfrom
xgame92:xgame92/fix-vite-d1-migrations-path

Conversation

@xgame92

@xgame92 xgame92 commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Fixes #15484.

When deployments use a redirected config, resource provisioning currently writes the complete generated binding back to the original user config. Generated configs can contain paths rebased relative to their own location, so provisioning a D1 database through the Vite plugin replaces a user-authored migrations_dir with a path that is invalid in the source config.

This changes redirected writeback to start from the original binding and overlay only the newly provisioned resource identifier. Non-redirected writeback remains unchanged, and bindings injected only by the redirected config are still excluded.

Tests:

  • pnpm --dir packages/wrangler test:ci src/__tests__/provision.test.ts
  • pnpm --dir packages/deploy-helpers check:type
  • pnpm --dir packages/wrangler check:type
  • changed-file oxlint and oxfmt checks

  • Tests
    • Tests included/updated
    • Automated tests not possible - manual testing has been completed as follows:
    • Additional testing not necessary because:
  • Public documentation
    • Cloudflare docs PR(s):
    • Documentation not necessary because: This fixes config writeback behavior without changing the public API or user workflow.

A picture of a cute animal (not mandatory, but encouraged)

@changeset-bot

changeset-bot Bot commented Sep 5, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: fdc6ad1

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 5 packages
Name Type
wrangler Patch
@cloudflare/deploy-helpers Patch
@cloudflare/vite-plugin Patch
@cloudflare/vitest-plugin Patch
@cloudflare/remote-bindings Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pkg-pr-new

pkg-pr-new Bot commented Sep 5, 2026

Copy link
Copy Markdown
@cloudflare/autoconfig

npm i https://pkg.pr.new/@cloudflare/autoconfig@15517

@cloudflare/build-output-utils

npm i https://pkg.pr.new/@cloudflare/build-output-utils@15517

@cloudflare/codemods

npm i https://pkg.pr.new/@cloudflare/codemods@15517

@cloudflare/config

npm i https://pkg.pr.new/@cloudflare/config@15517

create-cloudflare

npm i https://pkg.pr.new/create-cloudflare@15517

@cloudflare/deploy-helpers

npm i https://pkg.pr.new/@cloudflare/deploy-helpers@15517

@cloudflare/kv-asset-handler

npm i https://pkg.pr.new/@cloudflare/kv-asset-handler@15517

miniflare

npm i https://pkg.pr.new/miniflare@15517

@cloudflare/pages-functions

npm i https://pkg.pr.new/@cloudflare/pages-functions@15517

@cloudflare/pages-shared

npm i https://pkg.pr.new/@cloudflare/pages-shared@15517

@cloudflare/unenv-preset

npm i https://pkg.pr.new/@cloudflare/unenv-preset@15517

@cloudflare/vite-plugin

npm i https://pkg.pr.new/@cloudflare/vite-plugin@15517

@cloudflare/vitest-plugin

npm i https://pkg.pr.new/@cloudflare/vitest-plugin@15517

@cloudflare/workers-auth

npm i https://pkg.pr.new/@cloudflare/workers-auth@15517

@cloudflare/workers-editor-shared

npm i https://pkg.pr.new/@cloudflare/workers-editor-shared@15517

@cloudflare/workers-utils

npm i https://pkg.pr.new/@cloudflare/workers-utils@15517

wrangler

npm i https://pkg.pr.new/wrangler@15517

commit: fdc6ad1

@xgame92

xgame92 commented Sep 5, 2026

Copy link
Copy Markdown
Contributor Author

CI note: the only failing check is Vite Plugin Playground (windows-latest, vite-8), where the unrelated react-spa experimental headers/redirects suite timed out in beforeAll after the matrix had completed 94 suites / 287 tests. I reproduced that exact suite locally on Windows with Vite 8.1.5 after building the plugin: 1 file passed, with 6 passing and 3 expected-failure tests, in 8.39s. I cannot rerun the GitHub job because failed-job reruns require repository admin permission.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Untriaged

Development

Successfully merging this pull request may close these issues.

Wrangler D1 Migrations Path Bug (Vite Plugin)

2 participants