thank you! it works!
Hello, I’ve been trying to fix this issue on my companies site all day. I’ve tried every variation and combination of things suggested here. The prebuild script, adding the env variable, using netlify/plugin-nextjs at the version you suggested. our next is latest, react is latest, react-dom is latest. Any help would be very appreciated.
This solved it for me, brilliant
I have encountered this issue of 500 internal server error with my two deployed sites and managed to resolve it by running this line:
npm install -D @netlify/plugin-nextjs@4.37.4
I honestly do not know what causing the issue and if this is a long term solution but i think it works for now!
We’re experiencing this with "next": "13.4.19"
using app router.
Root page.js
loads fine but even a simple directory/page.js
is having this issue when loaded by itself. It does work however if navigated to from a next link from the root page…
Any update?
UPDATE:
We were able to resolve by adding the prebuild script and downgrading next
to 13.4.9
Add "prebuild": "node prebuild.js"
to package.json
scripts
Add prebuild.js
console.log("********* PREBUILDING");
const path = require("node:path");
const fs = require("fs");
const baseDir = process.cwd();
const prebuildScripts = async () => {
const file = path.join(
baseDir,
"/node_modules",
"next/dist/server/require-hook.js"
);
const content = await fs.promises.readFile(file, "utf-8");
await fs.promises.writeFile(
file,
content.replace(
"if (process.env.__NEXT_PRIVATE_PREBUNDLED_REACT) {",
"if (true) {"
)
);
};
prebuildScripts();
Your solution works for me too! !!
In my case only page witch is server-side rendered at runtime returned 500 error, but only when loaded directly (i.e when refreshing). When navigated by link from site menu it works fine.
Thank you, great job.
site Id: 32c3e9ed-88e5-49ed-85fc-322bb1e31aa9
Lemme know how long will it take to update it.
There’s nothing to update.
Hello, just want to thank you for all your support. I was having the issue described in this thread, here’s what i did:
-
Next is at 13.3.1
-
@netlify/plugin-nextjs is at 4.36.1
-
Set experimental mode to “true” on next.config.js (below for people just starting out like myself):
this is my next.config.js file:
/** @type {import(‘next’).NextConfig} */
const nextConfig = {
experimental: {
appDir: true,
},
}
module.exports = nextConfig
With these changes, app is currently deployed and working! I’m a true beginning at this, started on netlify yesterday, with Nextjs a week ago. So if I can deploy a website, i don’t see why others won’t be able to!
Thank you again for all your help, your responses along this thread helped me a lot in finding the right configuration. I’m not saying people have to do exactly what I did, maybe they can do without setting the experimental mode to true. Just sharing what worked for me
Best wishes!
can you add to my site
site id: 2f5a9c5a-226e-49da-8aa3-d937c18875af
47760133-1af3-46cb-80fc-262d8ced86c7
Thank you
can you add to my site
site id: 8559efa8-d015-4ebb-b9cb-b60f9e18205c
is getting this site id added still needed for fixing something???