fix(wrangler): explain how to resolve a user/deploy configuration conflict - #15534
fix(wrangler): explain how to resolve a user/deploy configuration conflict#15534vahidshaik1901 wants to merge 1 commit into
Conversation
…flict
When `findRedirectedWranglerConfig()` found a user configuration file and a
`.wrangler/deploy/config.json` under different base paths, it reported the
conflict and stopped there:
Found both a user configuration file at "wrangler.jsonc"
and a deploy configuration file at "../.wrangler/deploy/config.json".
But these do not share the same base path so it is not clear which should be used.
Both paths are discovered by searching up the directory tree independently, so
they can settle in different directories, and nothing in the message said which
one Wrangler wanted or what to do about it. The reader is left guessing whether
to move a file, delete one, or run the command from somewhere else.
The message now names the path the deploy configuration would have to sit at to
be applied, suggests deleting it when it is left over from a previous build or
running the command from the directory that owns the intended configuration, and
links to the Generated Wrangler configuration documentation.
The expected path was already computed by the conflict check itself, so it is
lifted into a variable and reused rather than recomputed.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018W34ieE3NNGaRQBxj5CKkH
🦋 Changeset detectedLatest commit: 5004915 The changes in this PR will be included in the next version bump. This PR includes changesets to release 9 packages
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 |
|
Codeowners approval required for this PR:
Show detailed file reviewers
|
| Please either delete "${path.relative(".", deployConfigPath)}" if it is left over from a previous build, | ||
| or run this command from the directory containing the configuration you want to use. |
There was a problem hiding this comment.
🟡 Deeper configurations remain unusable
When the wanted configuration is below the unwanted one, run this command repeats the same conflict. Both find.file searches walk upward, so the deeper directory still discovers the unwanted ancestor.
Prompt for agents
The conflict guidance does not resolve every path ordering. Both the user configuration lookup in findWranglerConfig and the deploy configuration lookup in findRedirectedWranglerConfig search upward. Running from a deeper desired configuration's directory therefore continues to find the unwanted configuration in an ancestor. Update the guidance to offer a remedy that works when the desired configuration is deeper, such as an applicable explicit configuration option or removing, moving, or regenerating the conflicting ancestor file. Add tests for selecting each file in both existing path-ordering scenarios.
Was this helpful? React with 👍 or 👎 to provide feedback.
@cloudflare/autoconfig
@cloudflare/build-output-utils
@cloudflare/codemods
@cloudflare/config
create-cloudflare
@cloudflare/deploy-helpers
@cloudflare/kv-asset-handler
miniflare
@cloudflare/pages-functions
@cloudflare/pages-shared
@cloudflare/unenv-preset
@cloudflare/vite-plugin
@cloudflare/vitest-plugin
@cloudflare/workers-auth
@cloudflare/workers-editor-shared
@cloudflare/workers-utils
wrangler
commit: |
|
The two red checks are unrelated to this PR — evidence below so nobody has to re-derive it. This PR changes the text of one Tests (macOS, packages-and-tools) — turbo reports exactly one failed task, That test asserts Chrome shut down over CDP without the fallback Tests (Windows, fixtures) — one failed task, A file-watching test on Windows, again unrelated to the changed package. Both look like the |
Fixes #8722.
When a user configuration file and a
.wrangler/deploy/config.jsonare found under different base paths, the error reported the conflict and stopped there:Both paths are discovered by searching up the directory tree independently, so they can settle in different directories. Nothing in the message said which location Wrangler actually wanted, or what to do about it — the reader is left guessing whether to move a file, delete one, or run the command somewhere else.
Changes
The message now:
The expected path was already being computed inline by the conflict condition, so it is lifted into a variable and reused rather than recomputed.
New output for the first existing test case:
Testing
This error already had coverage in
findWranglerConfig.test.ts; both existing inline snapshots are updated, and they exercise the two ways the paths can diverge — deploy config deeper than the user config, and shallower than it. All 975 tests across the 29 test files inpackages/workers-utilspass.check:type,oxfmtandoxlint --deny-warningsare clean.