Skip to content

Commit

Permalink
Ignore cached account id when CLOUDFLARE_ACCOUNT_ID is specified (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
jspspike authored Sep 11, 2023
1 parent a986f19 commit 0ba5884
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/stupid-islands-relax.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"wrangler": patch
---

Ignore cached account id when `CLOUDFLARE_ACCOUNT_ID` is specified
4 changes: 3 additions & 1 deletion packages/wrangler/src/user/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ import {
getCloudflareAccessToken,
getCloudflareAPITokenFromEnv,
getCloudflareGlobalAuthEmailFromEnv,
getCloudflareAccountIdFromEnv,
getCloudflareGlobalAuthKeyFromEnv,
getRevokeUrlFromEnv,
getTokenUrlFromEnv,
Expand Down Expand Up @@ -1096,9 +1097,10 @@ export async function getAccountId(): Promise<string | undefined> {

// check if we have a cached value
const cachedAccount = getAccountFromCache();
if (cachedAccount) {
if (cachedAccount && !getCloudflareAccountIdFromEnv()) {
return cachedAccount.id;
}

const accounts = await getAccountChoices();
if (accounts.length === 1) {
saveAccountToCache({ id: accounts[0].id, name: accounts[0].name });
Expand Down

0 comments on commit 0ba5884

Please sign in to comment.