Delete pages project, script error

Hello, I need to delete one of my project with more than 100 deploys. I use the script they give to delete all deployments, as usual but... even this throw an error ^^" Any idea ? Thanks 🙂
No description
4 Replies
Omnislash
OmnislashOP•2mo ago
nevermind I could fix the index.js, project is gone 🙂
texan
texan•2mo ago
@Omnislash if you want to drop your fix I’ll pass it along to the team to validate+update docs
Omnislash
OmnislashOP•2mo ago
Sure :), I'll be on my computer in a few hours Basically it tries to find the currentProductionId (if I remember the name correctly) but couldn't find it. Maybe because my project was unlinked since it was already removed from github. At first it was breaking because tried to get the id from underined/null. So I added optional chaining on it but... it actually just throw anyway when he cant find it, which is my screen. Since I didn't care about it, the goal being to delete the project, I just commented the retrieval and check of currentProdId altogether and it works fine. I actually did ctrl+c once under 100 branches to delete it from the website so, can't be sure it would have been ok until the end 🙂 Will send the index in a few hours I commented it this way at the end of the file :
// const productionDeploymentId = await getProductionDeploymentId()
// console.log(
// `Found live production deployment to exclude from deletion: ${productionDeploymentId}`
// )

console.log('Listing all deployments, this may take a while...')
const deploymentIds = await listAllDeployments()

for (id of deploymentIds) {
// if (id === productionDeploymentId) {
// console.log(`Skipping production deployment: ${id}`)
// } else {
try {
await deleteDeployment(id)
await sleep(500)
} catch (error) {
console.log(error)
}
// }
}
}
// const productionDeploymentId = await getProductionDeploymentId()
// console.log(
// `Found live production deployment to exclude from deletion: ${productionDeploymentId}`
// )

console.log('Listing all deployments, this may take a while...')
const deploymentIds = await listAllDeployments()

for (id of deploymentIds) {
// if (id === productionDeploymentId) {
// console.log(`Skipping production deployment: ${id}`)
// } else {
try {
await deleteDeployment(id)
await sleep(500)
} catch (error) {
console.log(error)
}
// }
}
}
texan
texan•2mo ago
Thanks, will pass along to the team!

Did you find this page helpful?