Deploy failed - not valid JSON

  • Astro frontend: https://ensphere.netlify.app
  • Kirby CMS: https://cms.ensphere.de

While deploying my Astro website on Netlify I am getting this error:

3:18:02 PM: 13:18:00   ├─ /en/index.htmlError fetching /global.json 500 Internal Server Error
3:18:02 PM: Unexpected token '<', "<!DOCTYPE "... is not valid JSON

The error doesn’t appear all the time, sometimes everything works fine.
You can find the mentioned JSON file here:
https://cms.ensphere.de/global.json

I already checked it with an online validator - it’s fine.

Can someone help me?

Thanks, Matt

Hi, @dba_communications. The first line shows that an error happened making the JSON request:

Error fetching /global.json 500 Internal Server Error

That error is being returned by your CMS which Netlify doesn’t control.

So, instead of getting JSON, the HTTP request returns HTML stating a 500 status code error occurred. However, your code isn’t checking for fetch errors so it proceeds and tried to process the HTML like it was JSON.

However, the JSON parses will never properly process the HTML and this is causing a secondary error. The second line shows the start of the HTML error message:

"<!DOCTYPE "

Next steps are to add error handling to catch and possibly retry when 500 status errors occur and to debug the third-party CSM to find out why it is returning 500 status errors.