@hrishikesh some more info. I think that it’s all down to the __NEXT_PRIVATE_PREBUNDLED_REACT variable not being set, or not being able to set it, due to naming restrictions on Netlify and AWS.
I have managed to patch the netlify next-runtime package locally, and it’s all down to a single line of code:
The environment variable is not set, so it always gets the default mappings, and not the next or experimental mappings. I also had to add appDir: true into my next.config.js, even though it’s no longer classed as experimental in the latest NextJS release.
Just to keep this thread active, I also have this problem. I am trying to migrate all the sites from my company to netlify and this errors are a pain in the ass.
We currently have a Linux Server with Dokku, and works just fine the exactly same projects.
Anything else to try? Can anyone who’s spent some time with this outline the different approaches to working around this? I scrolled the thread but it’s been ongoing since May, lots of new versions, so it’s not clear what might/should work with Next 13.4.13.
This is part of my exploration in moving to from a Node.js server on Render.com to Netlify. I’d love to get this resolved so I can make a fair comparison.
I fixed my issues using a combination of fixes from this and other threads. I did not test these steps in the order I’ll post them here, but I believe they all together fix the issue.
I cannot understate how much I hate when a product puts me through this kind of esoteric ritual, and it’s making me reconsider using netlify. Huge props to the community.
Thanks! This summary helped me fix my issues after watching updates on this thread and github for days. No solution worked for me until I added the appDir flag to next.config.js which I assumed wasn’t needed since Next 13.4.
To summarise my final config:
I’m using “next”: “13.4.7”
I used ‘patch-package’ to make the modification from this post using “@netlify/plugin-nextjs”: “^4.40.0”
This fixed my issue of my “not-found.tsx” and “error.tsx” pages throw exceptions.