Skip to content

fix: extract region from ARN for cross-region SQS delivery#86

Open
tbashiyy wants to merge 1 commit intohectorvent:mainfrom
tbashiyy:fix/cross-region-sqs-delivery
Open

fix: extract region from ARN for cross-region SQS delivery#86
tbashiyy wants to merge 1 commit intohectorvent:mainfrom
tbashiyy:fix/cross-region-sqs-delivery

Conversation

@tbashiyy
Copy link
Copy Markdown

Summary

EventBridge and S3 were ignoring the region in SQS target ARNs when delivering messages, always using the emulator's default region. This caused cross-region SQS delivery to fail with NonExistentQueue errors.

Both services now extract the region from the ARN and pass it to the region-aware sendMessage overload, consistent with how Lambda and SNS targets are already handled.

Affected code paths:

  • EventBridgeService.invokeTarget — SQS branch (line 420)
  • S3Service.fireNotifications — queue notification loop (line 1027)

Type of change

  • Bug fix (fix:)
  • New feature (feat:)
  • Breaking change (feat!: or fix!:)
  • Docs / chore

AWS Compatibility

Incorrect behavior: EventBridgeService.invokeTarget and S3Service.fireNotifications called sqsService.sendMessage(queueUrl, payload, 0) (3-arg overload), which internally defaults to regionResolver.getDefaultRegion(). When the SQS target ARN specified a different region (e.g. arn:aws:sqs:eu-west-1:...), the message was sent to the wrong regional queue store, resulting in NonExistentQueue errors.

Other service integrations (SNS→SQS, EventBridge→Lambda, EventBridge→SNS) already extract the region correctly — only the two SQS paths were missing this.

Checklist

  • ./mvnw test passes locally
  • New or updated integration test added
  • Commit messages follow Conventional Commits

…ntBridge and S3

EventBridge and S3 were using the 3-argument sendMessage overload which
defaults to the emulator's default region, ignoring the region in the
target SQS ARN. This caused cross-region SQS delivery to fail with
NonExistentQueue errors. Now both services extract the region from the
ARN and pass it to the region-aware sendMessage overload, consistent
with how Lambda and SNS targets are already handled.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@hectorvent hectorvent added the sqs label Mar 26, 2026
@hectorvent
Copy link
Copy Markdown
Owner

Hi @tbashiyy, thanks for taking the time to contribute! We've seen your PR and will take a look soon.

To ensure this implementation stays robust, could you also open a PR in our compatibility suite at https://github.com/hectorvent/floci-compatibility-tests? This helps us validate that your changes keep working perfectly as the project evolves.

The Floci team

tbashiyy added a commit to tbashiyy/floci-compatibility-tests that referenced this pull request Apr 3, 2026
…ests

Validate that EventBridge and S3 notifications correctly deliver messages
to SQS queues in a different region (eu-west-1) when the target ARN
specifies a non-default region. Covers the fix in hectorvent/floci#86.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Owner

@hectorvent hectorvent left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @tbashiyy,

Thanks for the PR!

Could you please update the commit history to remove the Co-authored-by: Claude <...> line from the commit message? We prefer to keep the attribution focused on human contributors for this project. Once that's cleaned up, I'm happy to take another look!

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants