hygraph / gatsby-source-graphcms

The official Gatsby source plugin for GraphCMS projects
https://graphcms.com
MIT License
145 stars 41 forks source link

Delta sourcing fails if GraphCMS webhook contains payload #100

Closed ynnoj closed 4 years ago

notrab commented 4 years ago

How does webhooks work currently? What is the required options in GraphCMS webhooks setup for preview/builds?

ynnoj commented 4 years ago

@notrab The toolkit exposes APIs to capture and action webhooks. If a re-build is triggered from a webhook, then the corresponding Gatsby node will be updated/created (via a GraphQL query) or deleted.

https://github.com/GraphCMS/gatsby-source-graphcms/blob/f3dba5560cb45e40c491e461db3d3a306fb8e6e6/gatsby-source-graphcms/gatsby-node.js#L88-L116

Right now you just need to setup your GraphCMS webhooks without payloads for builds and previews to be triggered. This issue is to address that.

Perhaps at some point we can use the payload from the webhook to update the Gatsby nodes, rather than firing a GraphQL query. However there's manual node work required for that so it's a bit more cumbersome.

ynnoj commented 4 years ago

Due to some recent changes to GraphCMS webhook payloads, this is no longer an issue.