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
fix(cli): fail fast in non-TTY environments instead of hanging on config-creation prompts (#1199)
When `open-next.config.ts` or `wrangler.(toml|json|jsonc)` is missing,
the CLI prompts the user to auto-create it. In non-TTY environments
(Cloudflare Workers Builds, Docker, CI) the Enquirer prompt can't read
stdin, so the build hangs on a truncated prompt and exits with a
cryptic code. Both prompts now throw an actionable error in
non-interactive mode; interactive behavior is unchanged.
// In non-interactive environments (CI, Cloudflare Workers Builds,
46
+
// Docker, etc.) the prompt would hang or crash. Fail fast with a
47
+
// clear message pointing at the existing escape hatch.
48
+
if(isNonInteractiveOrCI()){
49
+
thrownewError(
50
+
"No `wrangler.(toml|json|jsonc)` config file found.\n\nCreate one at the project root before running the build, or skip this check with `--skipWranglerConfigCheck` or `SKIP_WRANGLER_CONFIG_CHECK=yes`."
51
+
);
52
+
}
53
+
44
54
constconfirmCreate="No `wrangler.(toml|json|jsonc)` config file found, do you want to create one?";
// In non-interactive environments (CI, Cloudflare Workers Builds,
67
+
// Docker, etc.) there is no TTY to answer a prompt — the build would
68
+
// hang or crash. Fail fast with an actionable message instead.
69
+
if(isNonInteractiveOrCI()){
70
+
thrownewError(
71
+
`No \`${OPEN_NEXT_CONFIG_FILE_NAME}\` file was found in the project root.\n\nThis file is required for OpenNext Cloudflare builds.\nRun \`opennextjs-cloudflare migrate\` to create it, or see https://opennext.js.org/cloudflare/get-started for setup guidance.\nCommit it and re-run the build.`
72
+
);
73
+
}
74
+
61
75
constanswer=awaitaskConfirmation(
62
-
"Missing required `open-next.config.ts` file, do you want to create one?"
76
+
`Missing required \`${OPEN_NEXT_CONFIG_FILE_NAME}\` file, do you want to create one?`
63
77
);
64
78
65
79
if(!answer){
66
-
thrownewError("The `open-next.config.ts` file is required, aborting!");
80
+
thrownewError(`The \`${OPEN_NEXT_CONFIG_FILE_NAME}\` file is required, aborting!`);
0 commit comments