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
Deploy succesfull for site -
creative-biscuit-58753c.netlify.app
But nextJS SSR function returns the error above. Tried upgrading and downgrading next version, no use.
Worked just fine on my last release a few weeks ago.
Their workaround solution is to add a __next_private_prebundled_react env variable, which is not possible in netlify because it starts with an underscore? (or is there a way to set it anyway?)
I’m having the same issue, I even tried using Next 13.4.2. Ever since upgrading to Next 13.4, it has been happening. It seems like an issue with Next since they added a fix in one of the previous releases (13.3), but it hasn’t resolved the problem. I have provided more details about it in the next-runtime discussion, which can be found here.
Hi. Do you mind adding the variable for this site id: 842a3cc6-6d53-4d8f-85da-854ea2f433f2
I’m getting an error because “variable must start with a letter”
Hi @hrishikesh,
Do you mind adding the env var to my site as well. The siteID is f50f99c1-9959-499f-bccf-84ad47a8c51b.
I even added a Netlify Support email but looks like it will take a while. Hoping to get it done faster throug here.
Thank you.
You can use the Netlify CLI to add this environment variable, e.g.
➜ netlify env:set __NEXT_PRIVATE_PREBUNDLED_REACT next
Set environment variable __NEXT_PRIVATE_PREBUNDLED_REACT= next in the all context
nickyt.online on main [✘!?] via v18.15.0 took 3s
➜ netlify env:list
1 environment variable for site somesite in the dev context
.-------------------------------------------------.
| Environment variables |
|-------------------------------------------------|
| Key | Value | Scope |
|---------------------------------|-------|-------|
| __NEXT_PRIVATE_PREBUNDLED_REACT | next | All |
'-------------------------------------------------'
? Show values? Yes
Receiving this error when using that env variable, with the deploy failing: Invalid AWS Lambda parameters used in this request.
Confirmed it’s being set correctly and upgraded to Next.js 13.4.2 (latest). Anyone else been able to successfully deploy? Just tested over at Vercel and it works out-of-the-box (not surprisingly).
From what I’ve found, this happens on any error, including automatic handling of 404s, fetch requests that don’t return 200 and manually triggering notFound() in the page component. I’ve testet this up to 13.4.2 and it always leads to 500. It’s especially annoying because it’s impossible to debug what the underlying error is right now. You can try/catch yourself and avoid the problem, but it’s really not a solution.
Hey all! We’re aware of the issues around this change with Next.js and are working to ensure Next.js continues working normally on Netlify. As soon as we have any further updates, we’ll update this thread.
Would it be possible to have some more transparency on which version of next the netlify runtime currently supports “stable”? I feel like it’s really hard to get an answer on that and should at least be public in the runtime readme on github.
Hi, I have found quite a janky solutions but works for me.
Turns out the __NEXT_PRIVATE_PREBUNDLED_REACT environment variable might have nothing to do with build process regarding to NextJS code, it uses to override to uses Vercel’s precompiled react-dom that has ./server.edge imports on next/server runtime. Means that this variable has to be present in Lambda functions. But because of some quirks you cannot add them directly.
So, I do some patches to make react overriding to always trigger before starts any builds and my site now works normally without issues.