(edited)
Hello everyone, Hope you're all well. I'm new to the community.
I'm here because I face a problem when I trigger a redeployment using Vercel Rest API. Here's the function I use :
# Trigger a redeployment in Verceldef redeploy_vercel_project(): """Triggers a redeployment by selecting the latest successful deployment.""" url = f"{VERCEL_API_BASE_URL}/v6/deployments?projectId={VERCEL_PROJECT_ID}" if VERCEL_TEAM_ID: url += f"&teamId={VERCEL_TEAM_ID}" headers = {"Authorization": f"Bearer {VERCEL_API_TOKEN}"} deployments_response = requests.get(url, headers=headers) if deployments_response.status_code != 200: print(f"❌ Failed to fetch latest deployments: HTTP {deployments_response.status_code}") return deployments = deployments_response.json().get("deployments", []) # Filter out invalid deployments valid_deployments = [ d for d in deployments if d["state"] == "READY" and d.get("target") == "production" # Ensure it's a production deployment and d.get("source") != "redeploy" # Avoid re-redeploying already redeployed deployments and d.get("readySubstate") != "STAGED" # Ignore staged deployments ] if not valid_deployments: print("❌ No valid previous deployments found.") return # Select the most recent successful production deploymentAll other functions (Update Vercel ENV keys ...) are working and I can't find what is this 508 error.
Thank you in advance. Paul,