Internal Server Error after deploying headless Nextjs website

My Netlify page is throwing an “Internal Server Error” when I try to access the website.

Hi Team

Components:

  1. Sitecore XM Cloud
  2. Sitecore SXA website
  3. Sitecore Experience Edge
  4. Headless JSS, Nextjs framework

Steps to reproduce:

  1. Created SXA website using Sitecore XM Cloud portal (default basic website)
  2. Created Experience Edge API
  3. Noted down environment variable: JSS_APP_NAME, SITECORE_API_KEY, GRAPH_QL_ENDPOINT (https://edge.sitecorecloud.io/api/graphql/v1)
  4. Created a new site in Netlify using DevOps Project (ADO project is created by Sitecore XM Cloud in my private repository)
  5. Setup environment variable mentioned above.
  6. Configured Publish folder to src/sxastarter/.next
  7. Configured Runtime environment to Nextjs
  8. Deployed successfully
  9. next js version that I am using “next”: “^13.4.16”
  10. Node Js version: “nodeVersion”: “20.10.0”,

website link: https://main--nxa-xmc-site.netlify.app/

Problem:
After browsing the website(have only 2 initial pages: home and home/about) I see Internal server error. Checking the logs I saw the Sitecore pages are redirected to “/.netlify/builders/___netlify-odb-handler” and I am not sure what is causing 500 issue.

Please let me know what I am missing here or if more information is required regarding error. I won’t be able to give repository details.

The error seems related to a mechanism (the ODB handler) which we’re replacing for our upcoming version of Netlify Next.js Runtime (v5).
If you can upgrade to latest Next 13.5, you can opt-in your site to the new runtime and re-test.

@elad.rosenheim Thanks for your prompt reply i will update my next js version and do the deployment and update you once it is done. I am able to Optin that nextjs runtime new feature

1 Like

@elad.rosenheim I have updated nextJS version to 13.5 and opted nextjs runtime 5.0.0 and re-run the Build and Internal server error got resolved.

Thanks for your help

heck yeah! Well done. Thanks for coming back and sharing your solution with the community.