I using next.js 13.4.12
, app router and deploy with cloudflare pages.
when creating not-found.tsx
, the build fails with the following error.
ERROR: Failed to produce a Cloudflare Pages build from the project.
⚡️
⚡️ The following routes were not configured to run with the Edge Runtime:
⚡️ - /_error
// app/not-found.tsx
import Link from "next/link";
export const runtime = "edge";
export default function NotFound() {
return (
<div>
<h2>Not Found</h2>
<Link href="/">Return Home</Link>
</div>
);
}
https://nextjs.org/docs/app/api-reference/file-conventions/not-found
Hello,
For reference, this issue is being tracked at [🐛 Bug]: Not-found page doesn't work with last vercel version v31.2.0 in edge runtime · Issue #413 · cloudflare/next-on-pages · GitHub
We believe that this may have surfaced in a recent change to the Vercel CLI and/or Next.js
I’m deploying my Nextjs app on pages. And i’m also adding edge as runtime in my server components. But at build time it give me error about /_error page that i’m not using edge export in this page. I did add edge as runtime in this page but it still gives me the same error. Please help.
Hi, If you are still struggeling check the doc here: https://vercel.com/docs/functions/edge-functions/quickstart#create-an-edge-api-route
Depending of your nextjs app, you should set the edge in your API (/api/api_name).