Skip to content

fix: pass auth profiles to vite - #14588

Merged
emily-shen merged 5 commits into
mainfrom
emily/fix-vite-profiles
Jul 13, 2026
Merged

fix: pass auth profiles to vite#14588
emily-shen merged 5 commits into
mainfrom
emily/fix-vite-profiles

Conversation

@emily-shen

@emily-shen emily-shen commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Fixes #14580


  • Tests
    • Tests included/updated
    • Automated tests not possible - manual testing has been completed as follows: ran wrangler logout; wrangler auth profile create/activate 'test'; vite dev in a directory with remote bindings. no oauth flow triggered, remote bindings used the 'test' profile. then deleted profile, and it required re-authing.
    • Additional testing not necessary because:
  • Public documentation
    • Cloudflare docs PR(s):
    • Documentation not necessary because: bugfix

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

@changeset-bot

changeset-bot Bot commented Jul 7, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 3ede3c3

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

This PR includes changesets to release 3 packages
Name Type
wrangler Patch
@cloudflare/vite-plugin Patch
@cloudflare/vitest-pool-workers 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

ask-bonk[bot]

This comment was marked as resolved.

@ask-bonk

ask-bonk Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Review posted successfully to PR #14588.

I reviewed the PR, which adds an import-time initProfileResolution() to the wrangler public API barrel to make the Vite plugin respect directory-activated auth profiles. I flagged 4 issues, ranked by severity:

  1. (High) Resolving against process.cwd() instead of the config file's directory (as the CLI does) means the fix silently fails when Vite runs from a different directory than the wrangler config — reproducing the original bug. Included an inline suggestion to resolve lazily from the plugin using dirname(configPath).
  2. (Medium) Import-time global side effect affects all consumers (including unstable_dev), doing filesystem reads and mutating the OAuth singleton on mere import.
  3. (Medium) The doc comment about the yargs handler "overriding later" is misleading for the Vite consumer, which has no yargs handler.
  4. (Low) Missing changeset and tests for a user-facing behavior change.

github run

@pkg-pr-new

pkg-pr-new Bot commented Jul 7, 2026

Copy link
Copy Markdown
@cloudflare/autoconfig

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

create-cloudflare

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

@cloudflare/deploy-helpers

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

@cloudflare/kv-asset-handler

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

miniflare

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

@cloudflare/pages-shared

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

@cloudflare/unenv-preset

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

@cloudflare/vite-plugin

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

@cloudflare/vitest-pool-workers

npm i https://pkg.pr.new/@cloudflare/vitest-pool-workers@14588

@cloudflare/workers-auth

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

@cloudflare/workers-editor-shared

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

@cloudflare/workers-utils

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

wrangler

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

commit: a3f521c

@emily-shen
emily-shen force-pushed the emily/fix-vite-profiles branch from bb98bf0 to 8e9a085 Compare July 8, 2026 15:23
@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

✅ All changesets look good

@emily-shen
emily-shen force-pushed the emily/fix-vite-profiles branch from 8e9a085 to 7400be0 Compare July 8, 2026 16:55
devin-ai-integration[bot]

This comment was marked as resolved.

@emily-shen
emily-shen force-pushed the emily/fix-vite-profiles branch from 7400be0 to 953cb57 Compare July 10, 2026 10:12
@emily-shen
emily-shen marked this pull request as ready for review July 10, 2026 11:02
@workers-devprod
workers-devprod requested review from a team and jamesopstad and removed request for a team July 10, 2026 11:03
@workers-devprod

workers-devprod commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Codeowners approval required for this PR:

  • ✅ @cloudflare/wrangler
Show detailed file reviewers

@emily-shen
emily-shen force-pushed the emily/fix-vite-profiles branch from f6092b6 to bf8a21d Compare July 10, 2026 12:29
Comment thread packages/vite-plugin-cloudflare/src/miniflare-options.ts Outdated
devin-ai-integration[bot]

This comment was marked as resolved.

@jamesopstad jamesopstad left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there some way we can test this so it doesn't regress or is it too difficult?

Comment thread .changeset/fix-auth-profiles-vite-plugin.md Outdated

@workers-devprod workers-devprod left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codeowners reviews satisfied

@github-project-automation github-project-automation Bot moved this from Untriaged to Approved in workers-sdk Jul 13, 2026
@emily-shen
emily-shen force-pushed the emily/fix-vite-profiles branch from 55e252e to 3ede3c3 Compare July 13, 2026 11:31
@emily-shen
emily-shen merged commit eb99ab1 into main Jul 13, 2026
64 of 65 checks passed
@github-project-automation github-project-automation Bot moved this from Approved to Done in workers-sdk Jul 13, 2026
@emily-shen
emily-shen deleted the emily/fix-vite-profiles branch July 13, 2026 13:10
tpmmorris pushed a commit to tpmmorris/workers-sdk that referenced this pull request Jul 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

bug: @cloudflare/vite-plugin ignores active wrangler auth profiles and defaults to default.toml

3 participants