Skip to content

Reuse existing SQS queue on install instead of failing#67

Merged
kpconnell merged 1 commit into
mainfrom
fix/sqs-queue-already-exists
Jun 29, 2026
Merged

Reuse existing SQS queue on install instead of failing#67
kpconnell merged 1 commit into
mainfrom
fix/sqs-queue-already-exists

Conversation

@kpconnell

Copy link
Copy Markdown
Owner

Problem

Re-running the installer against an SQS queue that already existed failed with "a queue already exists with the same name and different tags."

The installer GUI drives CloudPrint.Service.exe create-queue to provision queues. That subcommand passed Tags directly into CreateQueue, and SQS rejects the call when a same-named queue already exists with different tags. The attribute-mismatch fallback also filtered on ErrorCode == "QueueAlreadyExists" — a code AWSSDK.SQS v4 no longer emits (it throws QueueNameExistsException) — so that recovery path never fired either.

Fix (src/CloudPrint.Service/Program.cs, create-queue)

  • Stop passing Tags to CreateQueue; apply them afterward via an additive TagQueue call. This relies only on SQS's documented attribute-based create idempotency.
  • Catch QueueNameExistsException to reconcile attributes (the redrive policy) on a pre-existing queue.
  • Applies to both the main queue and its dead-letter queue.

Testing

  • dotnet test218 tests pass (185 Service + 33 Configurator.Core), 0 failures.
  • Service project builds clean.

🤖 Generated with Claude Code

The installer drives CloudPrint.Service.exe's `create-queue` subcommand to
provision queues. CreateQueue passed Tags inline, so re-running install against
a queue that already existed with different tags was rejected by SQS
("a queue already exists with the same name and different tags"). The
attribute-mismatch fallback also filtered on the obsolete error code
"QueueAlreadyExists", which AWSSDK.SQS v4 no longer emits — it throws
QueueNameExistsException — so that catch never fired either.

Apply tags via a separate additive TagQueue call rather than passing them to
CreateQueue (relying only on SQS's documented attribute-based create
idempotency), and catch QueueNameExistsException to reconcile attributes on a
pre-existing queue. Applies to both the main queue and its DLQ.
@kpconnell
kpconnell merged commit 0f72ec2 into main Jun 29, 2026
4 checks passed
@kpconnell
kpconnell deleted the fix/sqs-queue-already-exists branch June 29, 2026 14:29
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.

1 participant