fix: Throw a descriptive error when autoconfig cannot detect an output directory#12447
Conversation
🦋 Changeset detectedLatest commit: c25a42d The changes in this PR will be included in the next version bump. 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 |
|
Claude finished @dario-piotrowicz's task —— View job Changeset Review
The changeset file Title format: The title should not include the "fix:" prefix. According to the changeset README, the title should be "A single sentence with an imperative description of the change" without conventional commit prefixes (though the README notes that descriptions "can either use conventional commit prefixes (e.g., 'fix: remove unused option') or start with a capital letter"). However, looking at the examples in the README more carefully, I see that the format is flexible. The current title "fix: Throw a descriptive error when autoconfig cannot detect an output directory" does follow the conventional commit style that is mentioned as acceptable. Actually, upon re-reading the guidelines, the changeset is acceptable. The README states: "The changeset descriptions can either use conventional commit prefixes (e.g., 'fix: remove unused option') or start with a capital letter and describe the change directly." ✅ All changesets look good The changeset properly:
|
create-cloudflare
@cloudflare/kv-asset-handler
miniflare
@cloudflare/pages-shared
@cloudflare/unenv-preset
@cloudflare/vite-plugin
@cloudflare/vitest-pool-workers
@cloudflare/workers-editor-shared
@cloudflare/workers-utils
wrangler
commit: |
ba8651c to
8431acd
Compare
8431acd to
0441239
Compare
petebacondarwin
left a comment
There was a problem hiding this comment.
Minor typo and a question but otherwise LGTM
packages/wrangler/src/__tests__/autoconfig/details/get-details-for-auto-config.test.ts
Outdated
Show resolved
Hide resolved
…-for-auto-config.test.ts Co-authored-by: Pete Bacon Darwin <[email protected]>
5914381 to
ad12466
Compare
Co-authored-by: Pete Bacon Darwin <[email protected]>
| @@ -193,17 +261,9 @@ export async function getDetailsForAutoConfig({ | |||
| ); | |||
There was a problem hiding this comment.
🟡 Duplicate sendMetricsEvent call for autoconfig_detection_completed in the non-configured success path
When getDetailsForAutoConfig() reaches the success path for a non-configured project (i.e., outputDir is detected and configured is false), the autoconfig_detection_completed metrics event is sent twice with identical payloads.
Root Cause
The new code at lines 241-250 adds a sendMetricsEvent call for the success case, but the original sendMetricsEvent call at lines 252-261 was not removed. This is visible in the git diff: the PR inserted new logic (early returns for configured and !outputDir cases, each with their own metrics call, plus a success metrics call) above the pre-existing sendMetricsEvent block, but forgot to delete the original.
The result is that every successful detection for a non-configured project fires two identical autoconfig_detection_completed events, which will inflate metrics/analytics counts.
Impact: Metrics data for autoconfig detection will be inaccurate — every successful non-configured detection will be double-counted.
(Refers to lines 252-261)
Was this helpful? React with 👍 or 👎 to provide feedback.
Fixes https://jira.cfdata.org/browse/DEVX-2455
The changes here move the output dir validation to the details detection phase implemented by
getDetailsForAutoConfig()(which now throws an error if no output directory can be detected).Thanks to this we can provide a more clear (and hopefully actionable) error to the user or
wrangler setup/wrangler deploy --x-autoconfig.For example this is the before and after or

wrangler setupbeing run on an empty directory:A picture of a cute animal (not mandatory, but encouraged)