Netlify FetchError - Invalid response body issue

Hello - out of the blue today by Gatsby project would no longer deploy in Netlify, throwing a build error through gatsby-source-datocms and hitting up against the API endpoint.

My project builds locally and I’ve updated gatsby-source-datocms to the latest version. I’ve generated a new/checked my API token to make sure it’s visible to Netlify - I’m really at a loose end why this is happening! Each time I deploy and it fails, it’s one of the 2 issues below. Maybe I’ve done something silly and can’t remember - but would really appreciate some help here!

5:20:11 PM: error "gatsby-source-datocms" threw an error while running the createSchemaCustomization lifecycle:
5:20:11 PM: Invalid response body while trying to fetch https://site-api.datocms.com/site?include=item_types%2Citem_types.fields: Premature close
5:20:11 PM: 
5:20:11 PM: 
5:20:11 PM:   FetchError: Invalid response body while trying to fetch https://site-api.datoc  ms.com/site?include=item_types%2Citem_types.fields: Premature close
5:01:50 PM: error "gatsby-source-datocms" threw an error while running the createSchemaCustomization lifecycle:
5:01:50 PM: Invalid response body while trying to fetch https://site-api.datocms.com/docs/site-api-hyperschema.json: Premature close
5:01:50 PM: 
5:01:50 PM: 
5:01:50 PM:   FetchError: Invalid response body while trying to fetch https://site-api.datoc  ms.com/docs/site-api-hyperschema.json: Premature close

Hello @ourhouseuk,

Welcome to the forum!

Are you able to turn on additional logging in Netlify or your codebase? We need to see the actual HTTP requests and responses (being sent to/from site-api.datocms.com) to understand what is happening.

If you’ve been doing a lot of work or rebuilds recently, it might be due to hitting rate limits? Content Management API Overview — DatoCMS Docs

But without more details, it is hard to say :frowning: Can you add more logging and/or describe more of how your workflow works, please? If there’s anything you would like to share with us in private, you can email us at support@datocms.com and reference this thread. (If it helps, you can share the repo code with me at https://github.com/roger-datocms and add r.tuan@datocms.com as a view-only user in your Netlify, as long as I can see your logs there).

PS Side note: Our gatsby-source-datocms is unfortunately in maintenance mode (very few users use it now and we don’t have the resources to keep fixing it)… if you can’t fix it easily, you might have to consider using another source (like gatsby-source-graphql) and/or framework…? Sorry about that :frowning: But let’s see if we can fix the current issue more easily first, before resorting to anything drastic.