Bug Description
When running zeabur deploy --project-id <id> --name "my-service" and a service named my-service already exists, the CLI creates a new service named my-service-over instead of updating the existing one.
Steps to Reproduce
# First deploy
npx zeabur@latest deploy --project-id <id> --name "my-app" -i=false
# Second deploy (same name)
npx zeabur@latest deploy --project-id <id> --name "my-app" -i=false
# Result: creates "my-app-over" as a new service
Root Cause
In /internal/cmd/deploy/deploy.go, when --project-id is provided without --service-id, the code calls CreateEmptyService() unconditionally without checking if a service with the same name already exists.
Suggested Fix
Before creating a new service, check if one with the same --name already exists in the project:
- If it exists, reuse its service ID (same as providing
--service-id)
- Or error with:
"Service 'my-app' already exists (ID: xxx). Use --service-id to redeploy, or choose a different --name."
Environment
- CLI version: 0.14.0
- OS: macOS (Apple Silicon)
Bug Description
When running
zeabur deploy --project-id <id> --name "my-service"and a service namedmy-servicealready exists, the CLI creates a new service namedmy-service-overinstead of updating the existing one.Steps to Reproduce
Root Cause
In
/internal/cmd/deploy/deploy.go, when--project-idis provided without--service-id, the code callsCreateEmptyService()unconditionally without checking if a service with the same name already exists.Suggested Fix
Before creating a new service, check if one with the same
--namealready exists in the project:--service-id)"Service 'my-app' already exists (ID: xxx). Use --service-id to redeploy, or choose a different --name."Environment