👀 See Sanity in action: Watch product demo now →

Webhook Requests With New Documents - Document Doesn't Exist

2 replies
Last updated: Jun 7, 2021
Hello! After receiving a webhook request with newly created document in sanity sometimes when I’m trying to fetch it I will receive info that the document doesn’t exist. When I try again a few seconds later it’s there. Is this the expected behavior? Also similarly when the document is deleted If I fetch it immediately I will often receive the document but If I wait a few seconds te request will return a null. Is there a way to check what document was removed or the only available info after deletation is the id?
Jun 7, 2021, 9:25 AM
Yes, this is somewhat to be expected ('eventual consistency'), for example: https://github.com/sanity-io/sanity-algolia/blob/7d215059dd4088e6f12e83b0d6b2c341870ad365/src/index.ts#L59
Jun 7, 2021, 9:26 AM
okay, thank you!
Jun 7, 2021, 9:29 AM

Sanity.io – build remarkable experiences at scale

Sanity is a customizable solution that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.