[question] how rebuild happens automatically when something changes in product information!
Closed this issue · 5 comments
Prerequisites
- Put an X between the brackets on this line if you have done all of the following:
- Read through the README fully
- Ensured you are running Node v.10 or above
- Made sure you're using at least Gatsby v.2.0.15
- Checked that your issue isn't already filed
Description
I am trying to implement the retrigger the gatsby develop automatically whenever something changes in headless cms as this feature provided by gatsby-source-stripe. I found that when something changes in the product information on stripe website a webhook is retriggered and gatsby build initiated on the client side. But I didn't find the code which handles this trigger event in the source code. can anyone point out the code where we handle the webhook retrigger please!
Hello!
Appreciate the question, though this is most likely something handled outside of our plugin. I can try to help you though. A couple thoughts:
- Where do you have your Gatsby site hosted? If using Netlify (recommended), see this article for information about setting up incoming build webhooks.
- If you're editing product and sku information in the Stripe dashboard, you'll need to use Stripe webhooks associated with the following events, probably:
product.created
,product.deleted
,product.updated
(and the same ones for sku). A full list is here and the Stripe documentation about setting up webhooks is here.
Hope this helps! Let me know if you have any questions.
@njosefbeck thanks for your help. Yes, my site is hosted with Netlify :)
Okay, so with Netlify this should be rather simple!
- Go to Netlify and set up a Build Hook, as described in the article I linked above. Once you have your hook's URL...
- Go to https://dashboard.stripe.com/webhooks and click "Add Endpoint". Paste in the Netlify hook URL, and select all Events to send (search for Product and Sku and add all those).
- Test by changing a Product or Sku in your Stripe dashboard and see if your build gets triggered in Netlify.
I didn't read through the documentation too thoroughly, but that should be essentially what you need to do. Hope this helps! Let me know if it works for you.
@njosefbeck After reading the documentation and following your step as mention above I am able to set up. thank you very much for your help and time!
My pleasure! Glad you got it working 👍