sanity-plugin-vercel-deploy
sanity-plugin-vercel-deploy copied to clipboard
Disabling deletion in production also disables it in development environment
Activating the option "Disable the 'Delete' action for this item in production" prevents me from deleting the webhook item in the development environment too.
I encountered this issue after transferring the project to a new team on Vercel. I'm unable to customize the entire webhook element due to a validation error indicating that the token is not configured with the new project environment.
How should I proceed to delete the element?
Got a workaround. Display all documents of the type "webhook_deploy" in Vision. Determine the ID of the document and delete it with the mutateDocs script. For example:
import { getCliClient } from 'sanity/cli';
const client = getCliClient().withConfig({ apiVersion: '2021-10-21' });
const query = `*[_id == "vercel-deploy.uoUdDC87h2XkZuHCVFcTa"]`
const mutateDocs = async (query) => {
const docsToMutate = await client.fetch(query, {})
for (const doc of docsToMutate) {
console.log('uploading')
client
.delete(doc._id) // Document ID to delete
.then((updatedDoc) => {
console.log('Hurray, the doc is deleted!')
})
.catch((err) => {
console.error('Oh no, the update failed: ', err.responseBody)
})
}
}
mutateDocs(query)
sanity exec utils/deleteField.js --withUserToken
However, a deletion function that is always available in the development environment would be more practical. Thank you!
Got a workaround. Display all documents of the type "webhook_deploy" in Vision. Determine the ID of the document and delete it with the mutateDocs script. For example:
import { getCliClient } from 'sanity/cli'; const client = getCliClient().withConfig({ apiVersion: '2021-10-21' }); const query = `*[_id == "vercel-deploy.uoUdDC87h2XkZuHCVFcTa"]` const mutateDocs = async (query) => { const docsToMutate = await client.fetch(query, {}) for (const doc of docsToMutate) { console.log('uploading') client .delete(doc._id) // Document ID to delete .then((updatedDoc) => { console.log('Hurray, the doc is deleted!') }) .catch((err) => { console.error('Oh no, the update failed: ', err.responseBody) }) } } mutateDocs(query)
sanity exec utils/deleteField.js --withUserToken
However, a deletion function that is always available in the development environment would be more practical. Thank you!
Great! that worked for me, deleted a stuck project from the dashboard.