Site name: slackpic.netlify.app
I recently followed tips from other questions here, on how to properly add the module sharp
.
After adding the suggested fix from the answers, something seem to crash quite fast.
My build and deploy completes, but visiting the page results in a 500 Internal Server Error. And there is no logs to be found with regards to what may cause this.
Before adding sharp
in netlify.toml
, most of my page would work except for the one API route that tried to import the sharp module.
After adding it, nothing works. Even routes that doesn’t exist throw a server error.
Removing the suggested toml lines brings everything back up again
[functions]
external_node_modules = ["sharp"]
included_files = ["node_modules/sharp/**/*"]
Not sure if it is relevant, but netlify serve
still works locally.
Am I missing something from the other posts? Is this not the proposed solution anymore?
Could you try to upgrade your Next.js version to 13.5+ and then the Next.js Runtime to v5?
That certainly helped on the total, all-over server errors, yes. Thank you!
Now I am back to my original issue here, with sharp not being found on Netlify even with the toml configuration.
Error: Could not load the "sharp" module using the linux-x64 runtime
Configuring my package.json for cross-platform as per pnpm docs did no difference either. Both PNPM_FLAGS=--shamefully-hoist
and .npmrc is configured as per Netlify docs.
"pnpm": {
"supportedArchitectures": {
"os": ["current", "linux"],
"cpu": ["x64" ]
}
}
Do you happen to have some advice for this follow-up as well?
I also noticed that with the new Next v5 runtime, it no longer auto-detects Next-Auth and sets the environment variable. Is this intentional? I was unable to find it in the docs.
For anyone coming after here with the same problem:
Since Netlify are ran on AWS, the same issue and same fix from the sharp issue seemed to work swimmingly for me. Downgraded to sharp 0.32.6 and now everything works