@netlify/plugin-nextjs seems to break NextJS's {"notFound":true} behaviour

I’m building a NextJS application which I’m hosting in Netlify. Its still under development but I’ve recently found out that the 404 behaviour of our application is not working properly, all pages that do not exist result into “Internal Server Error” pages on my deployed site.

Locally it is showing the “Error: Failed to load static props” error, when I’m running my application as netlify dev with the Netlify CLI.

After spending quite some time on investigating this issue, I came to the conclusion this has to be a bug somewhere in the netlify nextjs plugin (@netlify/plugin-nextjs) because the native react endpoint is returning the expected response, but the netlify one isn’t.

When I’m running my application with Netlify’s CLI (netlify dev), a request to the native NextJS content endpoint returns the expected response:

Response body: {"notFound":true}

When I make the same request to the instance which is running in Netlify’s CLI, I’m getting a breaking HTML response which is breaking the server side rendering part of NextJS.

Response body: <!DOCTYPE html><html lang="nl-NL"><head><style data-next-hide-fouc="true">body{display:none}</style><noscript data-next-...

On my deployed site, when I look into the Function Next.js ISR handler logs, I see the following error there:

Mar 22, 03:13:09 PM: de06aa07 ERROR  MissingStaticPage [Error]: 
Failed to load static file for page: /nl-NL/404 Failed to download https://******.netlify.app/nl-NL/404.html: 404 Not Found at /var/task/node_modules/.pnpm/next@13.4.19_@babel+core@7.23.9_@opentelemetry+api@1.7.0_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/server/require.js:109:19

I’m using version 4.41.3 of @netlify/plugin-nextjs. Would appreciate some help!

I currently don’t have a custom 404.tsx page created, I’m using the default one of NextJS. I’ve also tried creating one but that doesn’t make a difference.

Issue with Next.js 14 Server Actions on Netlify: 404 Error on POST Request - Support - Netlify Support Forums

I’ve quickly checked this to confirm if updating to v5 solves the issue, it does! Thanks

thanks for confirming this was resolved! Cheers :partying_face: