Worked for me too! Thanks a lot!
I think Netlify runs prebuild
script automatically, so just those 2 steps solved the problem
Worked for me too! Thanks a lot!
I think Netlify runs prebuild
script automatically, so just those 2 steps solved the problem
So I created the prebuild.js file and pasted the code in. It’s in my root directory. added the npm script. but I’m still getting a failed build with the error: Invalid AWS Lambda parameters used in this request.
I’m using a NextJS 13 and the App Router and NextAuth. I made the move over to Vercel to continue testing, but they have their own set of issues and I’d really love to get this working on Netlify.
Additional errors from the Deploying phase:
2:54:34 PM: Starting to deploy site from ‘.next’
2:54:34 PM: Calculating files to upload
2:54:34 PM: 6 new files to upload
2:54:34 PM: 3 new functions to upload
2:55:56 PM: Failed to upload file: _ipx
2:55:56 PM: Failed to upload file: ___netlify-odb-handler
2:56:32 PM: Failed to upload file: ___netlify-handler
2:56:32 PM: Section completed: deploying
2:56:32 PM: Site deploy was successfully initiated
2:56:32 PM:
2:56:32 PM: (Deploy site completed in 1m 57.9s)
The fix for this has been released in Next.js Runtime v4.38.0. It would be soon rolled out to users using the plugin from the UI. But if someone wants to try it out now, feel free to install it manually: netlify/next-runtime: The Next.js Runtime allows Next.js to run on Netlify with zero configuration (github.com)
No other workaround should be needed.
The complete changelog can be found here: Release plugin-nextjs: v4.38.0 · netlify/next-runtime (github.com)
Using next-runtime 4.38.0, does not resolve the Issue on my side.
The prebuild script does work though.
Still error 500?
have you tried Error 500 nextjs 13 dinamic routing - #5 by designtoy ?
It’s a downgrade of next and the plugin. It worked out to me.
thanks for sharing this! (:
Yess with next-runtime 4.38.0 it still throws an 500 error.
But the error is thrown because of the missing export respectively the not prebuild react, which should be fixed with next-runtime 4.38.0 as stated in the release notes.
The error you are mentioning was happening to me before.
My app was only working with next < 13.3.2 and every upgrade to a higher version would result in a 500 error. But because of a different script error ( The app was working fine locally and on vercel ).
With the latest version of nextjs the error changed to the missing export though and i was able to resolve it with the prebuild script here.
But as said, only the prebuild script works, using next-runtime 4.38.0 does not resolve the issue.
EDIT: Nope actually it does not work again.
Now i got a 404 Error and the url gets a “/” appended.
Something is definitely broken. The only solution at the moment is the one mentioned by designtoy, from the other thread:
Downgrade nextjs to 13.3.1 and to use nextjs-runtime 4.36.1
Funnily enough next-runtime 4.38.0 (and 4.38.1) is actually CAUSING the issue for me now. I had the issue originally, and resolved it using the prebuild script in this thread. Everything was fine until 4.38.0 came out and now its broken again. I have had to revert to 4.37.4
4.37.4 WITHOUT prebuild script = error
4.37.4 WITH prebuild script = works fine
4.38.X WITHOUT prebuild script = error
4.38.X WITH prebuild script = error
I’m in the same situation as @grahamo. Had to roll back to 4.37.4. Hope this is solved soon : )
Everything was working fine for me (without the prebuild hack) up untill version v4.37.4
.
Now my builds are failing at runtime with v4.38.1
, making me unable to publish new updates to my nexts.js deploy…
Getting the following error with or without the prebuild hack:
Jun 23, 02:53:31 PM: 2d9f2eca 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
Jun 23, 02:53:31 PM: 2d9f2eca ERROR at new NodeError (node:internal/errors:387:5)
Jun 23, 02:53:31 PM: 2d9f2eca ERROR at throwExportsNotFound (node:internal/modules/esm/resolve:365:9)
Jun 23, 02:53:31 PM: 2d9f2eca ERROR at packageExportsResolve (node:internal/modules/esm/resolve:649:3)
Jun 23, 02:53:31 PM: 2d9f2eca ERROR at resolveExports (node:internal/modules/cjs/loader:554:36)
Jun 23, 02:53:31 PM: 2d9f2eca ERROR at Function.Module._findPath (node:internal/modules/cjs/loader:594:31)
Jun 23, 02:53:31 PM: 2d9f2eca ERROR at Function.Module._resolveFilename (node:internal/modules/cjs/loader:1012:27)
Jun 23, 02:53:31 PM: 2d9f2eca ERROR at /var/task/.netlify/functions-internal/___netlify-handler/requireHooks.js:91:40
Jun 23, 02:53:31 PM: 2d9f2eca ERROR at Function.Module._load (node:internal/modules/cjs/loader:871:27)
Jun 23, 02:53:31 PM: 2d9f2eca ERROR at Module.require (node:internal/modules/cjs/loader:1098:19)
Jun 23, 02:53:31 PM: 2d9f2eca ERROR at require (node:internal/modules/cjs/helpers:108:18) {
Jun 23, 02:53:31 PM: 2d9f2eca ERROR code: 'ERR_PACKAGE_PATH_NOT_EXPORTED'
Jun 23, 02:53:31 PM: 2d9f2eca ERROR }
Probably introduced in v4.38.0 as there are references to the NExt.js 13.4 support: Release plugin-nextjs: v4.38.0 · netlify/next-runtime · GitHub
======================
Tried modifying the prebuild hack to work on the new netlify plugin, but that gives me even worse errors:
Jun 23, 03:34:01 PM: 4d858684 ERROR TypeError: Cannot read properties of null (reading 'useContext')
at exports.useContext (/var/task/node_modules/react/cjs/react.production.min.js:24:118)
at Head (/var/task/.next/server/chunks/2261.js:282:44)
at renderWithHooks (/var/task/node_modules/next/dist/compiled/react-dom/cjs/react-dom-server.browser.development.js:8677:16)
at renderIndeterminateComponent (/var/task/node_modules/next/dist/compiled/react-dom/cjs/react-dom-server.browser.development.js:8751:15)
at renderElement (/var/task/node_modules/next/dist/compiled/react-dom/cjs/react-dom-server.browser.development.js:8986:7)
at renderNodeDestructiveImpl (/var/task/node_modules/next/dist/compiled/react-dom/cjs/react-dom-server.browser.development.js:9152:11)
at renderNodeDestructive (/var/task/node_modules/next/dist/compiled/react-dom/cjs/react-dom-server.browser.development.js:9124:14)
at renderNode (/var/task/node_modules/next/dist/compiled/react-dom/cjs/react-dom-server.browser.development.js:9331:12)
at renderChildrenArray (/var/task/node_modules/next/dist/compiled/react-dom/cjs/react-dom-server.browser.development.js:9280:7)
at renderNodeDestructiveImpl (/var/task/node_modules/next/dist/compiled/react-dom/cjs/react-dom-server.browser.development.js:9188:7)
Together with the previous error
I was having this error at runtime on all my URLs, starting with a deploy today, June 23, 2023. I fixed it for now by running:
npm install -D @netlify/plugin-nextjs@4.37.4
And redeploying. When it’s truly fixed, I’ll un-pin the nextjs plugin.
Can folks using Next.js v13.4+ along with Next.js Runtime v4.38.1+ share links to their sites and the specific deploys that were using this configuration?
I’ve even tried the prebuild script and it didn’t work.
My site is https://shawnproperty.netlify.app
Please how can I fix this?
I really need this urgently!!
Here is one of my staging environment:
https://64959e6fa5f8ea000810fb81--leadbox.netlify.app/
Site is “app.leadbox.be”
Install the plugin locally:
npm install -D @netlify/plugin-nextjs@4.37.4
And then add this to your netlify.toml
file (or create it in your root):
[[plugins]]
package = "@netlify/plugin-nextjs"
You will also need the pre-build hack given by lewisking in this thread.
thanks for sharing this with the community
Hello Support Team / Community,
I have tried pre-build step shared by @lewisking but still getting this error frequently. See full error below
I have also verified that pre-build step has ran during build process. Please suggest what am I missing.
Jun 30, 08:49:57 PM: 4a9f27b4 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:387:5)
at throwExportsNotFound (node:internal/modules/esm/resolve:365:9)
at packageExportsResolve (node:internal/modules/esm/resolve:649:3)
at resolveExports (node:internal/modules/cjs/loader:554:36)
at Function.Module._findPath (node:internal/modules/cjs/loader:594:31)
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:1012:27)
at /var/task/.netlify/functions-internal/___netlify-handler/requireHooks.js:91:40
at Function.Module._load (node:internal/modules/cjs/loader:871:27)
at Module.require (node:internal/modules/cjs/loader:1098:19)
at require (node:internal/modules/cjs/helpers:108:18) {
code: 'ERR_PACKAGE_PATH_NOT_EXPORTED'
}
Hi @kunal.saxena.kunal , thanks for reaching out.
Are you using the latest of the react-dom
package? Have you tried clearing your yarn and npm cache? If you have done all these things you can remove the node_modules
from your project and reinstall the dependencies.
I hope this helps!
I am using latest version of react-dom 18.2.0. I have tried building with
npm cache clean --force && npm run build
but still seeing this error.