You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Added a check in non-TTY environments for `account_id`, `CLOUDFLARE_ACCOUNT_ID` and `CLOUDFLARE_API_TOKEN`. If `account_id` exists in `wrangler.toml`
then `CLOUDFLARE_ACCOUNT_ID` is not needed in non-TTY scope. The `CLOUDFLARE_API_TOKEN` is necessary in non-TTY scope and will always error if missing.
resolves#827
"[31mX [41;31m[[41;97mERROR[41;31m][0m [1mMissing 'CLOUDFLARE_API_TOKEN' from non-TTY environment, please see docs for more info: TBD[0m
235
+
"[31mX [41;31m[[41;97mERROR[41;31m][0m [1mIn a non-interactive environment, it's necessary to set a CLOUDFLARE_API_TOKEN environment variable for wrangler to work. Please go to https://developers.cloudflare.com/api/tokens/create/ for instructions on how to create an api token, and assign its value to CLOUDFLARE_API_TOKEN.[0m
237
236
237
+
"
238
+
`);
239
+
});
240
+
it("should throw error with no account ID provided and no members retrieved",async()=>{
241
+
setIsTTY(false);
242
+
writeWranglerToml({
243
+
account_id: undefined,
244
+
});
245
+
process.env={
246
+
CLOUDFLARE_API_TOKEN: "picard",
247
+
CLOUDFLARE_ACCOUNT_ID: undefined,
248
+
};
249
+
writeWorkerSource();
250
+
mockSubDomainRequest();
251
+
mockUploadWorkerRequest();
252
+
mockOAuthServerCallback();
253
+
mockGetMemberships({
254
+
success: false,
255
+
result: [],
256
+
});
238
257
239
-
[31mX [41;31m[[41;97mERROR[41;31m][0m [1mDid not login, quitting...[0m
"[31mX [41;31m[[41;97mERROR[41;31m][0m [1mFailed to automatically retrieve account IDs for the logged in user. In a non-interactive environment, it is mandatory to specify an account ID, either by assigning its value to CLOUDFLARE_ACCOUNT_ID, or as \`account_id\` in your \`wrangler.toml\` file.[0m
runWrangler("secret put the-key --name script-name")
182
180
).rejects.toThrowErrorMatchingInlineSnapshot(
183
-
`"No account id found, quitting..."`
181
+
`"Failed to automatically retrieve account IDs for the logged in user. In a non-interactive environment, it is mandatory to specify an account ID, either by assigning its value to CLOUDFLARE_ACCOUNT_ID, or as \`account_id\` in your \`wrangler.toml\` file."`
"Missing 'CLOUDFLARE_API_TOKEN' from non-TTY environment, please see docs for more info: TBD"
421
+
thrownewError(
422
+
"In a non-interactive environment, it's necessary to set a CLOUDFLARE_API_TOKEN environment variable for wrangler to work. Please go to https://developers.cloudflare.com/api/tokens/create/ for instructions on how to create an api token, and assign its value to CLOUDFLARE_API_TOKEN."
@@ -1142,6 +1140,11 @@ export async function getAccountId(
1142
1140
.join("\n")
1143
1141
);
1144
1142
}
1143
+
}else{
1144
+
if(!isInteractive)
1145
+
thrownewError(
1146
+
`Failed to automatically retrieve account IDs for the logged in user. In a non-interactive environment, it is mandatory to specify an account ID, either by assigning its value to CLOUDFLARE_ACCOUNT_ID, or as \`account_id\` in your \`wrangler.toml\` file.`
0 commit comments