My netlify site name: sensational-kataifi-2e9a8d.netlify.app
Everything was working fine until a recent update to my Sanity Studio, and now when I update/add/delete posts I’m getting the following error:
Error enqueueing build. Build payload exceeded limit of 140 KB. Please make sure environment variables and/or webhook body don't exceed this size.
If I use curl to trigger the build with the webhook URL, it works fine. But making an actual change in the CMS returns the above error.
I unfortunately do not know enough to even know how I might go about limiting the size of the response to solve the issue.
If anyone has any helpful insight, it would be much appreciated.
The webhook is triggering a HUGO static build, which uses the Sanity JS client to fetch data and write out Markdown content files for the HUGO templates.
Please let me know if any other info would be helpful in diagnosing/solving the problem and I’ll post whatever I can.
Yes, you will need to ensure that Sanity does not send such large data in their deploy triggers; our system attempts to make the body available during build as $WEBHOOK_BODY so you can use it during build if you want (almost nobody does this, but there is a sample write-up here if you are curious: Conditionally rebuild a site on Netlify, based on a webhook payload | Melanie Richards). In all likelihood, your current build process does not use that data, but instead pulls from Sanity via API, so it is probably not even useful data that is blocking you
To address this, you will have to either:
convince sanity to send less data
or trigger builds some other way, since we cannot accept large webhook bodies to trigger a build.
For some customers, their CMS does this “on occasion” when they make a big update, but not normally; if this is your case, your next save will probably generate a smaller hook and the build will complete.
For others, the way they work always generates a large webhook body. You’ll need to pre-process that somehow, if this is your use case instead. The simplest way I can think of to do it is send the hook via zapier.com, since it can modify the data (removing the body or most of it) before forwarding to netlify to trigger a build, though of course you could write a netlify function (on a separate site!) to do this too, though I can’t advise you directly on that code.