netlify returns "Internal Server Error" when page not found rather than nextjs 404 page
Unanswered
useless posted this in #help-forum
uselessOP
as the title said, when i updated my site's paths, some where deleted and when i go to see the old ones, netlify returns an "Internal Server Error" from them rather than a 404 custm page from
not-found which i built20 Replies
uselessOP
to add something that the invalid paths/ routes are available in google search console and they are not yet cleared, so traffic is coming from google for these pages and netlify is serving them a
netlify functions log:
Internal Server Error rather my nextjs not-found pagenetlify functions log:
Sep 1, 05:03:24 PM: 4ade9072 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) {
code: 'ERR_PACKAGE_PATH_NOT_EXPORTED'
}Polar bear
npm update
npm audit fix --force
npm audit fix --force
if ur npm update fails run it with the --force flag
if u still have this issue, delete ur node modules and .next file and package lock json and npm install
then restart ur ide
@Polar bear if u still have this issue, delete ur node modules and .next file and package lock json and npm install
uselessOP
in local development and build everything works as expected but this error happens when i deploy to netlify, the site works fine but when i go to a route that isn’t available i get an internal server error
rather than 404 page from nextjs
would it be related to next 13.4.19 should i downgrade?
but netlify isn't accepting a specific package
for some reason
that's why I'm asking u to try and run these commands in order to fix it
try all these on top if it doesn't work then sure downgrade
uselessOP
okay
Polar bear
good luck my man
Polar bear
did it work?
@Polar bear did it work?
uselessOP
my laptop is not in my reach rn, but when i get home i will do that
uselessOP
@Polar bear sorry for the late response but i got sick and now i did what you said.
still didn't work
still didn't work
i don't know if this is related but my build shows
Route (app) Size First Load JS
├ ○ /_not-found 0 B 0 B