Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/twenty-ears-rescue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"wrangler": patch
---

improve multi account error message in non-interactive mode
2 changes: 1 addition & 1 deletion packages/wrangler/src/__tests__/deploy.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,7 @@ describe("deploy", () => {
await expect(runWrangler("deploy index.js")).rejects
.toMatchInlineSnapshot(`
[Error: More than one account available but unable to select one in non-interactive mode.
Please set the appropriate \`account_id\` in your Wrangler configuration file.
Please set the appropriate \`account_id\` in your Wrangler configuration file or assign it to the \`CLOUDFLARE_ACCOUNT_ID\` environment variable.
Available accounts are (\`<name>\`: \`<account_id>\`):
\`enterprise\`: \`1701\`
\`enterprise-nx\`: \`nx01\`]
Expand Down
6 changes: 3 additions & 3 deletions packages/wrangler/src/__tests__/kv.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1275,7 +1275,7 @@ describe("wrangler", () => {
await expect(runWrangler("kv key get key --namespace-id=xxxx"))
.rejects.toThrowErrorMatchingInlineSnapshot(`
[Error: More than one account available but unable to select one in non-interactive mode.
Please set the appropriate \`account_id\` in your Wrangler configuration file.
Please set the appropriate \`account_id\` in your Wrangler configuration file or assign it to the \`CLOUDFLARE_ACCOUNT_ID\` environment variable.
Available accounts are (\`<name>\`: \`<account_id>\`):
\`one\`: \`1\`
\`two\`: \`2\`]
Expand All @@ -1291,7 +1291,7 @@ describe("wrangler", () => {
await expect(runWrangler("kv key get key --namespace-id=xxxx"))
.rejects.toThrowErrorMatchingInlineSnapshot(`
[Error: More than one account available but unable to select one in non-interactive mode.
Please set the appropriate \`account_id\` in your Wrangler configuration file.
Please set the appropriate \`account_id\` in your Wrangler configuration file or assign it to the \`CLOUDFLARE_ACCOUNT_ID\` environment variable.
Available accounts are (\`<name>\`: \`<account_id>\`):
\`one\`: \`1\`
\`two\`: \`2\`]
Expand Down Expand Up @@ -1332,7 +1332,7 @@ describe("wrangler", () => {
await expect(runWrangler("kv key get key --namespace-id=xxxx"))
.rejects.toThrowErrorMatchingInlineSnapshot(`
[Error: More than one account available but unable to select one in non-interactive mode.
Please set the appropriate \`account_id\` in your Wrangler configuration file.
Please set the appropriate \`account_id\` in your Wrangler configuration file or assign it to the \`CLOUDFLARE_ACCOUNT_ID\` environment variable.
Available accounts are (\`<name>\`: \`<account_id>\`):
\`one\`: \`1\`
\`two\`: \`2\`]
Expand Down
2 changes: 1 addition & 1 deletion packages/wrangler/src/__tests__/pages/secret.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ describe("wrangler pages secret", () => {
runWrangler("pages secret put the-key --project some-project-name")
).rejects.toThrowErrorMatchingInlineSnapshot(`
[Error: More than one account available but unable to select one in non-interactive mode.
Please set the appropriate \`account_id\` in your Wrangler configuration file.
Please set the appropriate \`account_id\` in your Wrangler configuration file or assign it to the \`CLOUDFLARE_ACCOUNT_ID\` environment variable.
Available accounts are (\`<name>\`: \`<account_id>\`):
\`account-name-1\`: \`account-id-1\`
\`account-name-2\`: \`account-id-2\`
Expand Down
2 changes: 1 addition & 1 deletion packages/wrangler/src/__tests__/secret.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ describe("wrangler secret", () => {
await expect(runWrangler("secret put the-key --name script-name"))
.rejects.toThrowErrorMatchingInlineSnapshot(`
[Error: More than one account available but unable to select one in non-interactive mode.
Please set the appropriate \`account_id\` in your Wrangler configuration file.
Please set the appropriate \`account_id\` in your Wrangler configuration file or assign it to the \`CLOUDFLARE_ACCOUNT_ID\` environment variable.
Available accounts are (\`<name>\`: \`<account_id>\`):
\`account-name-1\`: \`account-id-1\`
\`account-name-2\`: \`account-id-2\`
Expand Down
2 changes: 1 addition & 1 deletion packages/wrangler/src/user/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1204,7 +1204,7 @@ export async function getAccountId(): Promise<string> {
if (e instanceof NoDefaultValueProvided) {
throw new UserError(
`More than one account available but unable to select one in non-interactive mode.
Please set the appropriate \`account_id\` in your ${configFileName(undefined)} file.
Please set the appropriate \`account_id\` in your ${configFileName(undefined)} file or assign it to the \`CLOUDFLARE_ACCOUNT_ID\` environment variable.
Available accounts are (\`<name>\`: \`<account_id>\`):
${accounts
.map((account) => ` \`${account.name}\`: \`${account.id}\``)
Expand Down