Upgrading to Next > 13.3.0 breaks the website

I was having trouble with my own app so I recreated a brand new repo which you can use to investigate. I noticed that as soon as I upgrade to Next 13.3.1 or above, the website stop working. While it is still able to build the website, when I try to access it it breaks, giving the following error:

May 12, 04:43:13 PM: 5b8f8995 ERROR  Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './server.edge' is not defined by "exports" in /var/task/node_modules/react-dom/package.jsonMay 12, 04:43:13 PM: 5b8f8995 ERROR      at new NodeError (node:internal/errors:387:5)May 12, 04:43:13 PM: 5b8f8995 ERROR      at throwExportsNotFound (node:internal/modules/esm/resolve:365:9)May 12, 04:43:13 PM: 5b8f8995 ERROR      at packageExportsResolve (node:internal/modules/esm/resolve:649:3)May 12, 04:43:13 PM: 5b8f8995 ERROR      at resolveExports (node:internal/modules/cjs/loader:554:36)May 12, 04:43:13 PM: 5b8f8995 ERROR      at Function.Module._findPath (node:internal/modules/cjs/loader:594:31)May 12, 04:43:13 PM: 5b8f8995 ERROR      at Function.Module._resolveFilename (node:internal/modules/cjs/loader:1012:27)May 12, 04:43:13 PM: 5b8f8995 ERROR      at /var/task/node_modules/next/dist/server/require-hook.js:180:36May 12, 04:43:13 PM: 5b8f8995 ERROR      at Function.Module._load (node:internal/modules/cjs/loader:871:27)May 12, 04:43:13 PM: 5b8f8995 ERROR      at Module.require (node:internal/modules/cjs/loader:1098:19)May 12, 04:43:13 PM: 5b8f8995 ERROR      at require (node:internal/modules/cjs/helpers:108:18) {May 12, 04:43:13 PM: 5b8f8995 ERROR    code: 'ERR_PACKAGE_PATH_NOT_EXPORTED'May 12, 04:43:13 PM: 5b8f8995 ERROR  }

The website domain is test-next13-netlify and the codebase is available at GitHub - KrustyC/next-netlify-test: Repo to reproduce Netlify Bug.

If you fork my repo and try to build in on Netlify you can see that it build just fine, but then if you upgrade Next to a version above what is currently installed, or to the latest, the website will not work anymore.

I have even tried to upgrade @netlify/plugin-nextjs to 4.36.1, but that is even worse as it gives me an issue middleware is not a function, which I thought was due to not having @netlify/next installed, but again if I install the package then it breaks even worse, whether I set NEXT_DISABLE_NETLIFY_EDGE to true or not.

If you need anything else from me please just comment and I would be more than willing to help in any way I can.

@KrustyC,

Please don’t post duplicates: Server.edge not defined Error on nextJS SSR functions cause site to return 500 Errors

You have commented in that thread, one other thread and this thread as well. This slows us down :slight_smile: