···11+---
22+"@opennextjs/cloudflare": patch
33+---
44+55+fix the error message of getCloudflareContext
66+77+Hardcode function names that would get mangled otherwise.
+5-1
examples/bugs/gh-219/next.config.ts
···11import type { NextConfig } from "next";
2233const nextConfig: NextConfig = {
44- /* config options here */
44+ eslint: {
55+ // Warning: This allows production builds to successfully complete even if
66+ // your project has ESLint errors.
77+ ignoreDuringBuilds: true,
88+ },
59};
610711export default nextConfig;
+8-11
packages/cloudflare/src/api/cloudflare-context.ts
···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
6565- const getContextFunctionName = getCloudflareContext.name;
6666- const initFunctionName = initOpenNextCloudflareForDev.name;
6765 throw new Error(
6868- `\n\n\`${getContextFunctionName}\` has been called during development without having called` +
6969- ` the \`${initFunctionName}\` function inside the Next.js config file.\n\n` +
7070- `In order to use \`${getContextFunctionName}\` import and call ${initFunctionName} in the Next.js config file.\n\n` +
7171- "Example: \n ```\n // next.config.mjs\n\n" +
7272- ` import { ${initFunctionName} } from "@opennextjs/cloudflare";\n\n` +
7373- ` ${initFunctionName}();\n\n` +
7474- " /** @type {import('next').NextConfig} */\n" +
7575- " const nextConfig = {};\n" +
6666+ `\n\nERROR: \`getCloudflareContext\` has been called without having called` +
6767+ ` \`initOpenNextCloudflareForDev\` from the Next.js config file.\n` +
6868+ `You should update your Next.js config file as shown below:\n\n` +
6969+ " ```\n // next.config.mjs\n\n" +
7070+ ` import { initOpenNextCloudflareForDev } from "@opennextjs/cloudflare";\n\n` +
7171+ ` initOpenNextCloudflareForDev();\n\n` +
7272+ " const nextConfig = { ... };\n" +
7673 " export default nextConfig;\n" +
7774 " ```\n" +
7878- "\n(note: currently middlewares in Next.js are always run using the edge runtime)\n\n"
7575+ "\n"
7976 );
8077 }
8178