Sitemap.xml getting a 500 error page - NextJS build

Hello! I’m generating a sitemap for Nextjs 14 and it works fine on local and also it works on other hosting platforms.

On Netlify, I’m getting a 500 error page when I visit the sitemap.

I’m not getting any errors during the build, the site works great.

Getting these messages on console when I visit

  "name": "Internal Server Error.",
  "message": "500 - Internal Server Error.",
  "statusCode": 500
A client-side exception has occurred, see here for more info:

Hi @dweberdev,

Thanks for reaching out and welcome to Netlify’s Support Forums!

Could you provide us with with the sitename where you’re hosting the site on Netlify? For example,