Skip to content

fix(deploy): reuse existing service by name to prevent duplicates#223

Open
stantheman0128 wants to merge 1 commit intozeabur:mainfrom
stantheman0128:fix/deploy-duplicate-service-by-name
Open

fix(deploy): reuse existing service by name to prevent duplicates#223
stantheman0128 wants to merge 1 commit intozeabur:mainfrom
stantheman0128:fix/deploy-duplicate-service-by-name

Conversation

@stantheman0128
Copy link
Copy Markdown

Summary

  • When deploying with --project-id and --name but without --service-id, the CLI now checks if a service with the same name already exists before creating a new one
  • If found, it reuses the existing service (same as providing --service-id)
  • The --create flag can still be used to explicitly force creating a new service

Root Cause

In runDeploy, when --project-id is provided without --service-id, the code calls CreateEmptyService() unconditionally without checking for name collisions. This creates duplicate services (e.g. my-app-over).

Changes

  • internal/cmd/deploy/deploy.go: Before creating a new service, call ListAllServices to check if one with the same name already exists. If it does, reuse it. If --create is explicitly set, always create a new service.

Fixes #203

Test plan

  • Deploy with --project-id --name "my-app" twice — second deploy should update existing service, not create duplicate
  • Deploy with --project-id --name "my-app" --create — should always create a new service
  • Deploy with --project-id --service-id — behavior unchanged (uses provided service ID)

🤖 Generated with Claude Code

…cates

When deploying with --project-id and --name but without --service-id,
the CLI unconditionally creates a new service via CreateEmptyService.
If a service with the same name already exists, this creates a duplicate
(e.g. "my-app-over").

Fix by looking up existing services in the project first and reusing
any service that matches the given name. The --create flag can still
be used to force creating a new service.

Fixes zeabur#203

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 10, 2026

Warning

Rate limit exceeded

@stantheman0128 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 2 minutes and 44 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 2 minutes and 44 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 0ccc45ad-8df2-4ff7-b623-b37dac681004

📥 Commits

Reviewing files that changed from the base of the PR and between 4750f37 and bc02f61.

📒 Files selected for processing (1)
  • internal/cmd/deploy/deploy.go
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

deploy without --service-id creates duplicate services instead of updating existing

1 participant