Troubleshooting deployment and build issues with Sanity and Gatsby starter

12 replies
Last updated: May 16, 2020
👋 I recently started playing around with the
starter, big fan of Sanity so far, clean and simple. Now that I've made a bunch of edits to Studio and Web, I'm trying to redeploy on netlify but both keep failing. I've tried to clear cache and deploy with no luck. Keep getting a few errors:
Failed at the sanity-gatsby-portfolio@0.0.0 postinstall script.

failed during stage 'building site': Build script returned non-zero exit code: 1

Any chance you guys could point me in the right direction to fix this?
May 4, 2020, 8:06 PM
Looks like it was because i was using
May 4, 2020, 8:50 PM
Nice catch, Maxim, and welcome! 👋 Are you good to go? Let us know if you’re still seeing any hiccups when deploying to Netlify 🙂
May 4, 2020, 9:46 PM
Running into a build issue currently
May 16, 2020, 9:14 PM
trying to use the default figure schema to add an image to my site settings, this works fine locally
May 16, 2020, 9:14 PM
but when i run
npm run build
i get an error
May 16, 2020, 9:14 PM
WebpackError: TypeError: Cannot read property 'asset' of undefined
May 16, 2020, 9:14 PM
Hi Maxim, assuming
is part of another field such as
, you might have one or more documents without an image. Have you tried checking for
before loading the asset? For example:
{post.image && <Img fluid={post.image.asset.fluid} />}
May 16, 2020, 9:17 PM
hmm, this is only for site settings, so there's only 1 document
May 16, 2020, 9:21 PM
and there's an image, it shows up locally
May 16, 2020, 9:21 PM
when i stringify, i get
May 16, 2020, 9:22 PM
{ "crop": null, "hotspot": null, "asset": { "_id": "image-7c8184f501642d65ca85c7fbaf58bef874c19ab1-400x400-jpg" }, "alt": "Picture of Maxim Siebert" }
May 16, 2020, 9:22 PM
What’s on line 26 of
? Or better, do you have a link to a repo? (in DM if you prefer) 🙂
May 16, 2020, 9:27 PM

Sanity– build remarkable experiences at scale

The Sanity Composable Content Cloud is the headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Was this answer helpful?