-
Notifications
You must be signed in to change notification settings - Fork 1.1k
feat(wrangler): add warning when account_id mismatch detected on auth error #11683
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
… error When a 401 authentication error occurs, display a warning if the account_id in the Wrangler configuration does not match any of the user's authenticated accounts. This helps users identify configuration issues where they may have the wrong account ID set in their wrangler.toml file. Fixes #9358 Co-Authored-By: [email protected] <[email protected]>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
🦋 Changeset detectedLatest commit: 7c3ed78 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 @ascorbic's task —— View job Changeset Review Complete
✅ All changesets look good The changeset
|
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: |
…error (v3 backport) Backport of #11683 to v3-maintenance branch. When a 401 authentication error occurs, display a warning if the account_id in the Wrangler configuration does not match any of the user's authenticated accounts. This helps users identify configuration issues where they may have the wrong account ID set in their wrangler.toml file. Fixes #9358 Co-Authored-By: [email protected] <[email protected]>
Move the default value assignment to the variable declaration instead of the catch block. This is a minor simplification as the full optional chaining approach doesn't work due to type constraints - ComplianceConfig doesn't include account_id, only the full Config type does. Co-Authored-By: [email protected] <[email protected]>
|
(aside) I've reviewed this and it looks good. |
|
Failed to automatically backport this PR's changes to Wrangler v3. Please manually create a PR targeting the Depending on your changes, running Notes:
|
- Update changeset to mention both wrangler.toml and wrangler.jsonc - Convert inline comment to JSDoc for printAccountIdMismatchWarning function Co-Authored-By: [email protected] <[email protected]>
Address vicb's review feedback to add JSDoc documentation. Co-Authored-By: [email protected] <[email protected]>
… error (#11683) * feat(wrangler): add warning when account_id mismatch detected on auth error When a 401 authentication error occurs, display a warning if the account_id in the Wrangler configuration does not match any of the user's authenticated accounts. This helps users identify configuration issues where they may have the wrong account ID set in their wrangler.toml file. Fixes #9358 Co-Authored-By: [email protected] <[email protected]> * refactor: simplify complianceConfig initialization Move the default value assignment to the variable declaration instead of the catch block. This is a minor simplification as the full optional chaining approach doesn't work due to type constraints - ComplianceConfig doesn't include account_id, only the full Config type does. Co-Authored-By: [email protected] <[email protected]> * chore: address review feedback - Update changeset to mention both wrangler.toml and wrangler.jsonc - Convert inline comment to JSDoc for printAccountIdMismatchWarning function Co-Authored-By: [email protected] <[email protected]> * chore: add JSDoc to whoami function Address vicb's review feedback to add JSDoc documentation. Co-Authored-By: [email protected] <[email protected]> * Minor `whoami` JSDoc tweaks --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: Ben <[email protected]>
…error (v3 backport) (#11689) * fix(wrangler): add warning when account_id mismatch detected on auth error (v3 backport) Backport of #11683 to v3-maintenance branch. When a 401 authentication error occurs, display a warning if the account_id in the Wrangler configuration does not match any of the user's authenticated accounts. This helps users identify configuration issues where they may have the wrong account ID set in their wrangler.toml file. Fixes #9358 Co-Authored-By: [email protected] <[email protected]> * fix: capture configAccountId in middleware instead of catch block Move the config reading to the middleware callback where args is in scope, and capture configAccountId there. This fixes the TypeScript error where args was not defined in the catch block. Co-Authored-By: [email protected] <[email protected]> * style: fix formatting in whoami files Co-Authored-By: [email protected] <[email protected]> * chore: address review feedback - add JSDoc comments - Add JSDoc to whoami function - Add JSDoc to printAccountIdMismatchWarning function - Update changeset to mention wrangler.jsonc Co-Authored-By: [email protected] <[email protected]> * chore: add backticks to JSDoc parameter names Address NuroDev's review feedback to add backticks around parameter names in JSDoc comments. Co-Authored-By: [email protected] <[email protected]> --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
… error (cloudflare#11683) * feat(wrangler): add warning when account_id mismatch detected on auth error When a 401 authentication error occurs, display a warning if the account_id in the Wrangler configuration does not match any of the user's authenticated accounts. This helps users identify configuration issues where they may have the wrong account ID set in their wrangler.toml file. Fixes cloudflare#9358 Co-Authored-By: [email protected] <[email protected]> * refactor: simplify complianceConfig initialization Move the default value assignment to the variable declaration instead of the catch block. This is a minor simplification as the full optional chaining approach doesn't work due to type constraints - ComplianceConfig doesn't include account_id, only the full Config type does. Co-Authored-By: [email protected] <[email protected]> * chore: address review feedback - Update changeset to mention both wrangler.toml and wrangler.jsonc - Convert inline comment to JSDoc for printAccountIdMismatchWarning function Co-Authored-By: [email protected] <[email protected]> * chore: add JSDoc to whoami function Address vicb's review feedback to add JSDoc documentation. Co-Authored-By: [email protected] <[email protected]> * Minor `whoami` JSDoc tweaks --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: Ben <[email protected]>
Fixes #9358.
When a 401 authentication error occurs, this PR adds a warning if the
account_idin the Wrangler configuration does not match any of the user's authenticated accounts. This helps users identify configuration issues where they may have copied anaccount_idfrom another account or project.The warning is displayed after the account list in the
whoamioutput that appears on authentication errors, making it clear that the configured account ID is not accessible with the current credentials.Key changes:
printAccountIdMismatchWarningfunction inwhoami.tsthat checks if the configured account_id matches any authenticated accountshandleErrorto extractaccount_idfrom config and pass it towhoamiHuman review checklist:
Link to Devin run: https://app.devin.ai/sessions/d7fdc064c9914225b7de6694b36e0122
Devin PR requested by @ascorbic