@@ -62,20 +62,17 @@ export function getCloudflareContext<
6262 // the cloudflare context is initialized by the worker and is always present in production/preview
6363 // during local development (`next dev`) it might be missing only if the developers hasn't called
6464 // the `initOpenNextCloudflareForDev` function in their Next.js config file
65- const getContextFunctionName = getCloudflareContext . name ;
66- const initFunctionName = initOpenNextCloudflareForDev . name ;
6765 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" +
7673 " export default nextConfig;\n" +
7774 " ```\n" +
78- "\n(note: currently middlewares in Next.js are always run using the edge runtime)\n\n "
75+ "\n"
7976 ) ;
8077 }
8178
0 commit comments