Skip to content

fix(data_classes): resolve correct SQS queue URL for China and other AWS partitions (#8799) - #8814

Merged
leandrodamascena merged 2 commits into
aws-powertools:developfrom
dhairyakhandelwal880-dotcom:fix/sqs-queue-url-partitions
Nov 15, 2026
Merged

leandrodamascena merged 2 commits into
aws-powertools:developfrom
dhairyakhandelwal880-dotcom:fix/sqs-queue-url-partitions

Conversation

@dhairyakhandelwal880-dotcom

Copy link
Copy Markdown
Contributor

Issue number: closes #8799

Summary

Changes

  • Extract the partition (arn_parts[1]) in SQSRecord.queue_url from eventSourceARN.
  • Map the partition to its standard DNS suffix (aws -> amazonaws.com, aws-cn -> amazonaws.com.cn, aws-iso -> c2s.ic.gov, aws-iso-b -> sc2s.sgov.gov, aws-iso-e -> cloud.adc-e.uk, aws-iso-f -> csp.hci.ic.gov, aws-eusc -> amazonaws.eu), falling back to amazonaws.com for unknown partitions.
  • Add comprehensive parameterized unit tests for all partitions in tests/unit/data_classes/required_dependencies/test_sqs_event.py.

User experience

Before this change, record.queue_url for a queue in China (e.g. arn:aws-cn:sqs:cn-north-1:123456789012:my-queue) returned https://sqs.cn-north-1.amazonaws.com/123456789012/my-queue, which failed when used with boto3 SQS calls (delete_message, etc.) because the endpoint did not match the partition.

After this change, record.queue_url correctly produces https://sqs.cn-north-1.amazonaws.com.cn/123456789012/my-queue for China, and appropriate DNS suffixes for ISO and European Sovereign Cloud partitions.

Verification

  • Added test_sqs_record_queue_url_partitions covering aws, aws-cn, aws-us-gov, aws-iso, aws-iso-b, aws-iso-e, aws-iso-f, aws-eusc, and custom partition fallbacks.
  • Verified all 229 tests/unit/data_classes/ tests pass cleanly.
  • Formatted and linted with ruff.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

…AWS partitions (aws-powertools#8799)

Signed-off-by: dhairyakhandelwal880-dotcom <dhairyakhandelwal880@gmail.com>
@boring-cyborg

boring-cyborg Bot commented Nov 15, 2026

Copy link
Copy Markdown

Thanks a lot for your first contribution! Please check out our contributing guidelines and don't hesitate to ask whatever you need.
In the meantime, check out the #python channel on our Powertools for AWS Lambda Discord: Invite link

@boring-cyborg boring-cyborg Bot added the tests label Nov 15, 2026
@powertools-for-aws-oss-automation powertools-for-aws-oss-automation Bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Nov 15, 2026
…literal

Signed-off-by: dhairyakhandelwal880-dotcom <dhairyakhandelwal880@gmail.com>
@sonarqubecloud

Copy link
Copy Markdown

@leandrodamascena leandrodamascena added bug Something isn't working event_sources Event Source Data Class utility labels Nov 15, 2026
@leandrodamascena leandrodamascena added this to the 3.41.0 milestone Nov 15, 2026

@leandrodamascena leandrodamascena left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks @dhairyakhandelwal880-dotcom, and welcome! I checked your suffix table against botocore's partitions.json and all eight match, including the ISO ones and aws-eusc. Unknown partitions keeping amazonaws.com is the right fallback. Goes out in 3.41.0, no need to rebase, you'll be in the release notes.

@codecov

codecov Bot commented Nov 15, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.17%. Comparing base (d07a9c2) to head (d3a818e).

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #8814   +/-   ##
========================================
  Coverage    97.17%   97.17%           
========================================
  Files          323      323           
  Lines        16606    16610    +4     
  Branches      1504     1504           
========================================
+ Hits         16137    16141    +4     
  Misses         328      328           
  Partials       141      141           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@leandrodamascena
leandrodamascena merged commit ede7473 into aws-powertools:develop Nov 15, 2026
16 of 22 checks passed
@boring-cyborg

boring-cyborg Bot commented Nov 15, 2026

Copy link
Copy Markdown

Awesome work, congrats on your first merged pull request and thank you for helping improve everyone's experience!

@powertools-for-aws-oss-automation

Copy link
Copy Markdown

Awesome work, congrats on your first merged pull request and thank you for helping improve everyone's experience!

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

Labels

bug Something isn't working event_sources Event Source Data Class utility size/M Denotes a PR that changes 30-99 lines, ignoring generated files. tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: SQSRecord.queue_url uses amazonaws.com for queues in China and other partitions

2 participants