@@ -62,20 +62,17 @@ export function getCloudflareContext<
62
62
// the cloudflare context is initialized by the worker and is always present in production/preview
63
63
// during local development (`next dev`) it might be missing only if the developers hasn't called
64
64
// the `initOpenNextCloudflareForDev` function in their Next.js config file
65
- const getContextFunctionName = getCloudflareContext . name ;
66
- const initFunctionName = initOpenNextCloudflareForDev . name ;
67
65
throw new Error (
68
- `\n\n\`${ getContextFunctionName } \` has been called during development without having called` +
69
- ` the \`${ initFunctionName } \` function inside the Next.js config file.\n\n` +
70
- `In order to use \`${ getContextFunctionName } \` import and call ${ initFunctionName } in the Next.js config file.\n\n` +
71
- "Example: \n ```\n // next.config.mjs\n\n" +
72
- ` import { ${ initFunctionName } } from "@opennextjs/cloudflare";\n\n` +
73
- ` ${ initFunctionName } ();\n\n` +
74
- " /** @type {import('next').NextConfig} */\n" +
75
- " const nextConfig = {};\n" +
66
+ `\n\nERROR: \`getCloudflareContext\` has been called without having called` +
67
+ ` \`initOpenNextCloudflareForDev\` from the Next.js config file.\n` +
68
+ `You should update your Next.js config file as shown below:\n\n` +
69
+ " ```\n // next.config.mjs\n\n" +
70
+ ` import { initOpenNextCloudflareForDev } from "@opennextjs/cloudflare";\n\n` +
71
+ ` initOpenNextCloudflareForDev();\n\n` +
72
+ " const nextConfig = { ... };\n" +
76
73
" export default nextConfig;\n" +
77
74
" ```\n" +
78
- "\n(note: currently middlewares in Next.js are always run using the edge runtime)\n\n "
75
+ "\n"
79
76
) ;
80
77
}
81
78
0 commit comments