Netlify return internal server error 500 rather than page not found 404

Today I deployed a new version of the website and removed old paths and pages. In local dev, everything works amazing and even the local build is as the dev one. but when i deployed the site to netlify, problems started to appear:

  1. Going to old paths result in internal server error rather than redirecting to page not found 404 in Next.js
  2. Getting errors in function log for [GET] '/[OLD PATH]'

I also submitted a request removal to google console for removing old paths.

For the function log:

Sep 1, 06:21:54 PM: be63c3a8 ERROR  Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './server.edge' is not defined by "exports" in /var/task/node_modules/react-dom/package.json
    at new NodeError (node:internal/errors:405:5)
    at exportsNotFound (node:internal/modules/esm/resolve:364:10)
    at packageExportsResolve (node:internal/modules/esm/resolve:700:9)
    at resolveExports (node:internal/modules/cjs/loader:567:36)
    at Module._findPath (node:internal/modules/cjs/loader:636:31)
    at Module._resolveFilename (node:internal/modules/cjs/loader:1063:27)
    at /var/task/.netlify/functions-internal/___netlify-handler/requireHooks.js:100:40
    at Module._load (node:internal/modules/cjs/loader:922:27)
    at Module.require (node:internal/modules/cjs/loader:1143:19)
    at require (node:internal/modules/cjs/helpers:110:18) {
Sep 1, 06:21:54 PM: be63c3a8 INFO   [GET] /lb/gs/en/physics/009610010059000650020180827 (SSR)

I also added NEXT_DISABLE_NETLIFY_EDGE = true to remove edge function

And why do I still have 3 lambda functions deployed. The website has no SSR, no ISR and i don’t use next/image I am using <img/> instead. So how is that possibly happening with me not using any.

  • Site name:
  • Using Next JS 13 app router "next": "^13.4.19"
1 Like

Hi @abedshaaban, kindly try the environment variable __NEXT_PRIVATE_PREBUNDLED_REACT with the value next to see if it works.

Regarding the quoted error message above, you can also visit the official Next.js Github issues page below for more information on the error since your error is similar. Also read the suggestions there on how to fix it in case the above does not work.

Let me know the outcome.


That’s not supported by AWS, please don’t do it. Check out:

TL;DR: No solution yet.

@hrishikesh the marked solution to the forum post you shared is the same as the solution I provided.
Kindly be specific if you want @abedshaaban to try out the other suggestions in the post you shared or not since the solution posted here is the same as the solution to the post you shared.


I unmarked the solution, but it’s clearly mentioned several times in that same post by other users as well as us that that’s not supported. Not sure who marked it as a solution - maybe it appeared to work for them at first, so they did it and never came back to unmark it once they noticed it did not work.

With that being said, I’ve also mentioned in my previous message that there’s no solution yet, so there’s nothing to try out for @abedshaaban.

1 Like

issue resolved by upgrading to the latest nextjs version.