feat(sqs): add support for custom base_url#2441
Merged
DavidsonGomes merged 2 commits intoEvolutionAPI:developfrom Feb 24, 2026
Merged
feat(sqs): add support for custom base_url#2441DavidsonGomes merged 2 commits intoEvolutionAPI:developfrom
DavidsonGomes merged 2 commits intoEvolutionAPI:developfrom
Conversation
Contributor
Reviewer's guide (collapsed on small PRs)Reviewer's GuideAdds support for configuring a custom SQS base URL via environment/config and uses it when constructing queue URLs for event publishing. Sequence diagram for constructing SQS URL with optional custom base_urlsequenceDiagram
participant EventProducer
participant SqsController
participant ConfigService
participant Sqs
EventProducer->>SqsController: publishEvent(event, extra)
SqsController->>ConfigService: getSqsConfig()
ConfigService-->>SqsController: sqsConfig(Sqs)
alt custom BASE_URL configured
SqsController->>SqsController: baseUrl = sqsConfig.BASE_URL
else no custom BASE_URL
SqsController->>SqsController: baseUrl = https://sqs.REGION.amazonaws.com
end
SqsController->>SqsController: queueName = prefix_eventFormatted.fifo
SqsController->>SqsController: sqsUrl = baseUrl/ACCOUNT_ID/queueName
SqsController-->>EventProducer: result of publish (success/error)
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Contributor
There was a problem hiding this comment.
Hey - I've found 1 issue, and left some high level feedback:
- Consider normalizing
BASE_URL(e.g., trimming any trailing slashes) before concatenation so thatsqsUrlis well-formed and doesn't end up with//when a trailing slash is present in the env var. - You may want to treat
BASE_URLas optional in theSqstype (e.g.,BASE_URL?: string) and centralize the defaulting logic inConfigServiceso that consumers can assume a non-empty, fully-formed base URL.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Consider normalizing `BASE_URL` (e.g., trimming any trailing slashes) before concatenation so that `sqsUrl` is well-formed and doesn't end up with `//` when a trailing slash is present in the env var.
- You may want to treat `BASE_URL` as optional in the `Sqs` type (e.g., `BASE_URL?: string`) and centralize the defaulting logic in `ConfigService` so that consumers can assume a non-empty, fully-formed base URL.
## Individual Comments
### Comment 1
<location path="src/api/integrations/event/sqs/sqs.controller.ts" line_range="126-130" />
<code_context>
: `${event.replace('.', '_').toLowerCase()}`;
const queueName = `${prefixName}_${eventFormatted}.fifo`;
- const sqsUrl = `https://sqs.${sqsConfig.REGION}.amazonaws.com/${sqsConfig.ACCOUNT_ID}/${queueName}`;
+ const baseUrl = sqsConfig.BASE_URL || `https://sqs.${sqsConfig.REGION}.amazonaws.com`;
+ const sqsUrl = `${baseUrl}/${sqsConfig.ACCOUNT_ID}/${queueName}`;
const message = {
</code_context>
<issue_to_address>
**suggestion:** Handle potential trailing slashes in `BASE_URL` to avoid double slashes in the final SQS URL.
If `SQS_BASE_URL` includes a trailing slash (e.g. `https://sqs.us-east-1.amazonaws.com/`), `sqsUrl` will end up with a double slash before the account id. Please normalize `baseUrl` first (e.g. strip a trailing `/` or use a helper to safely join URL segments) before building `sqsUrl`.
```suggestion
? 'singlequeue'
: `${event.replace('.', '_').toLowerCase()}`;
const queueName = `${prefixName}_${eventFormatted}.fifo`;
const rawBaseUrl =
sqsConfig.BASE_URL || `https://sqs.${sqsConfig.REGION}.amazonaws.com`;
const baseUrl = rawBaseUrl.replace(/\/+$/, '');
const sqsUrl = `${baseUrl}/${sqsConfig.ACCOUNT_ID}/${queueName}`;
```
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📋 Description
This adds support for configuring a custom SQS base_url, enabling the use of LocalStack SQS in a local development environment.
🔗 Related Issue
Closes #(issue_number)
🧪 Type of Change
🧪 Testing
📸 Screenshots (if applicable)
✅ Checklist
📝 Additional Notes