ndimatteo / sanity-plugin-vercel-deploy

Custom plugin to trigger webhooks from your Sanity Studio.
MIT License
99 stars 20 forks source link

Deploys from Sanity not clearing cache #26

Closed samuelgoddard closed 1 year ago

samuelgoddard commented 2 years ago

Hey! First off, thanks so much for the plugin, I use it on pretty much all of my projects and it's been great. Since last week i've noticed that deploys from within the studio don't seem to clear the build cache and the new content isn't actually being loaded into the site once deployed. Any idea what may be causing this? If I build the same deploy from within Vercel it works fine.

Cheers!

ovsw commented 2 years ago

As far as I know from reading the Vercel docs here https://vercel.com/docs/concepts/git/deploy-hooks#build-cache the build cache is used automatically for builds triggered via hooks. You have to append ?buildCache=false to the hook request to clear the cache.

So, you just need to:

  1. create a new Deployment from the sanity admin panel (since you can't edit an existing one)
  2. when pasting in your deploy hook from Vercel, just append the ?buildCache=false part to it. Rest of the settings can be as in the initial deploy.
ndimatteo commented 1 year ago

Hey there @samuelgoddard sorry I never followed back up on this, but it seems like this is something that can be dealt with in the setup of each deployment by appending ?buildCache=false to the hook URL.

Feel free to let me know if you think this should be handled a different way, or if there are still issues!