this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

error-msg (#307)

authored by

Victor Berchet and committed by
GitHub
9d45ee84 ac529547

+20 -12
+7
.changeset/nervous-pumpkins-try.md
··· 1 + --- 2 + "@opennextjs/cloudflare": patch 3 + --- 4 + 5 + fix the error message of getCloudflareContext 6 + 7 + Hardcode function names that would get mangled otherwise.
+5 -1
examples/bugs/gh-219/next.config.ts
··· 1 1 import type { NextConfig } from "next"; 2 2 3 3 const nextConfig: NextConfig = { 4 - /* config options here */ 4 + eslint: { 5 + // Warning: This allows production builds to successfully complete even if 6 + // your project has ESLint errors. 7 + ignoreDuringBuilds: true, 8 + }, 5 9 }; 6 10 7 11 export default nextConfig;
+8 -11
packages/cloudflare/src/api/cloudflare-context.ts
··· 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