✨Discover storytelling in the AI age with Pixar's Matthew Luhn at Sanity Connect, May 8th—register now

Issue with publishing a document breaking watchmode in Gatsby-Sanity setup.

17 replies
Last updated: Feb 10, 2021
Does anyone know why publishing a document ends up breaking 
so that the server needs to be restarted?
Feb 10, 2021, 5:53 PM
Hi User. I’m just looking into this now.
Feb 10, 2021, 5:56 PM
user S
it seems to work great now as long as it’s a draft, but as soon as I press publish it all stops working. Tried both locally and using a digitalocean droplet for preview
Feb 10, 2021, 5:57 PM
Okay, I set up the sanity-gatsby-blog starter and gave this a try, and nothing seemed to get disrupted by publishing. Are you getting any sort of errors in your terminal (where you’re running
npm run dev
) when you publish? Do you also have overlayDrafts set to true?
Also, I’m still in the early learning stages of Gatsby so if I say something that doesn’t apply or is wrong, apologies in advance. That said, I want to see this working for you.
Feb 10, 2021, 6:42 PM
If you’re using
but have
turned off, I wonder if your issue may be related to this one: https://github.com/sanity-io/gatsby-source-sanity/issues/50
Feb 10, 2021, 6:48 PM
user S
! I have overlayDrafts on. Does nothing happen at all when you press publish?
Feb 10, 2021, 7:52 PM
Will read through that, thanks!
Feb 10, 2021, 7:53 PM
Okay, if you have overlayDrafts set to true then I don’t think that GitHub page will apply.
When I press publish everything works and I can continue editing.
Feb 10, 2021, 7:56 PM
Would you mind running
DEBUG=sanity* npm run dev
to start your server and seeing if that gives you any insight, both when you edit a draft and when you publish?
Feb 10, 2021, 8:01 PM
I’m running on localhost now and when pressing publish, the screen turns white. I’m sing Gatsby btw and this is on the frontend that’s consuming data from Sanity using
plugin. It’s a barebone setup now.
Feb 10, 2021, 8:32 PM
I only got the following by using sanity debug:

sanity Draft deleted, no published version exist, delete node +1s
Feb 10, 2021, 8:33 PM
I realized now even though the preview site turns white, if I do some changes in the editor, it starts working/ showing properly again
Feb 10, 2021, 8:34 PM
If you inspect your dev tools when the preview page goes white, does it give any clues? Does the preview div structure remain or does it disappear?
Feb 10, 2021, 8:41 PM
user S
It seems to be working fine all the sudden now after restarting everything.
Feb 10, 2021, 8:47 PM
I tried restarting earlier as well btw but the issue remained so it’s a bit of a mystery haha
Feb 10, 2021, 8:48 PM
Thank you so much for the help though
user S
you’re awesome!
Feb 10, 2021, 8:48 PM
Hey, we’ll take it! 🙂 I’m glad to hear that and hope it lasts!
Feb 10, 2021, 8:48 PM
I hope so to 😄
Feb 10, 2021, 8:48 PM

Sanity– build remarkable experiences at scale

Sanity is a modern 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?