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 {
116
116
* @default true
117
117
*/
118
118
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 ;
119
127
} ;
120
128
}
121
129
Original file line number Diff line number Diff line change @@ -36,9 +36,9 @@ export function ensureCloudflareConfig(config: OpenNextConfig) {
36
36
}
37
37
38
38
if ( Object . values ( requirements ) . some ( ( satisfied ) => ! satisfied ) ) {
39
- throw new Error (
39
+ const errorMessage =
40
40
"The `open-next.config.ts` should have a default export like this:\n\n" +
41
- `{
41
+ `{
42
42
default: {
43
43
override: {
44
44
wrapper: "cloudflare-node",
@@ -61,7 +61,11 @@ export function ensureCloudflareConfig(config: OpenNextConfig) {
61
61
queue: "dummy" | "direct" | function,
62
62
},
63
63
},
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 ) ;
66
70
}
67
71
}
You can’t perform that action at this time.
0 commit comments