File tree Expand file tree Collapse file tree 2 files changed +14
-5
lines changed
packages/cloudflare/src/api Expand file tree Collapse file tree 2 files changed +14
-5
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " @opennextjs/cloudflare " : patch
3+ ---
4+
5+ fix incorrect (sync) ` getCloudflareContext ` error message
6+
7+ currently ` getCloudflareContext ` run in sync mode at the top level of a not static route
8+ gives a misleading error message saying that the function needs to be run in a not static
9+ route, the changes here correct this error message clarifying that the problem actually is
Original file line number Diff line number Diff line change @@ -118,11 +118,11 @@ function getCloudflareContextSync<
118118 // normal global state so we throw with a helpful error message.
119119 if ( inSSG ( ) ) {
120120 throw new Error (
121- `\n\nERROR: \`getCloudflareContext\` has been called in a static route,` +
122- ` that is not allowed, this can be solved in different ways:\n \n` +
123- ` - call \`getCloudflareContext({async: true})\` to use the \`async\` mode \n` +
124- ` - avoid calling \`getCloudflareContext\` in the route \n` +
125- ` - make the route non static \n`
121+ `\n\nERROR: \`getCloudflareContext\` has been called in sync mode in either a static route or at the top level of a non-static one ,` +
122+ ` both cases are not allowed but can be solved by either: \n` +
123+ ` - make sure that the call is not at the top level and that the route is not static \n` +
124+ ` - call \`getCloudflareContext({async: true}) \` to use the \`async\` mode \n` +
125+ ` - avoid calling \`getCloudflareContext\` in the route \n`
126126 ) ;
127127 }
128128
You can’t perform that action at this time.
0 commit comments