File tree Expand file tree Collapse file tree 3 files changed +21
-4
lines changed Expand file tree Collapse file tree 3 files changed +21
-4
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " @opennextjs/cloudflare " : patch
3+ ---
4+
5+ add a ` cloudflare.dangerousDisableConfigValidation ` config option to not throw on validation of the config
Original file line number Diff line number Diff line change @@ -116,6 +116,14 @@ interface OpenNextConfig extends AwsOpenNextConfig {
116116 * @default true
117117 */
118118 useWorkerdCondition ?: boolean ;
119+
120+ /**
121+ * Disable throwing an error when the config validation fails.
122+ * This is useful for overriding some of the default provided by cloudflare.
123+ * **USE AT YOUR OWN RISK**
124+ * @default false
125+ */
126+ dangerousDisableConfigValidation ?: boolean ;
119127 } ;
120128}
121129
Original file line number Diff line number Diff line change @@ -36,9 +36,9 @@ export function ensureCloudflareConfig(config: OpenNextConfig) {
3636 }
3737
3838 if ( Object . values ( requirements ) . some ( ( satisfied ) => ! satisfied ) ) {
39- throw new Error (
39+ const errorMessage =
4040 "The `open-next.config.ts` should have a default export like this:\n\n" +
41- `{
41+ `{
4242 default: {
4343 override: {
4444 wrapper: "cloudflare-node",
@@ -61,7 +61,11 @@ export function ensureCloudflareConfig(config: OpenNextConfig) {
6161 queue: "dummy" | "direct" | function,
6262 },
6363 },
64- }\n\n` . replace ( / ^ { 8 } / gm, "" )
65- ) ;
64+ }\n\n` . replace ( / ^ { 8 } / gm, "" ) ;
65+ if ( config . cloudflare ?. dangerousDisableConfigValidation ) {
66+ logger . warn ( errorMessage ) ;
67+ return ;
68+ }
69+ throw new Error ( errorMessage ) ;
6670 }
6771}
You can’t perform that action at this time.
0 commit comments