Sanity and GROQ-powered webhooks are great, but there is a bug!
Sanity recently launched their GROQ-powered webhooks, and they are really powerful! There is even a guide that explains projections, and one that explains filters.
The bug
I created a simple webhook like this, that posts a message to Slack whenever a new document of type user
is created.
When I later updated the webhook to only run for the production dataset, using the top drop-down, the webhook continued to fire on all datasets.
The workaround
One possible solution is doing the dataset filtering in GROQ, and not with the dropdown.
With this update, the webhook is only triggered for the production dataset.
Fixed
As of January 19th 2022, the bug is fixed and the workaround is no longer needed.