Skip to content

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

Closed

Description

@astroknot-sheep

Expected Behaviour

record.queue_url for a queue in cn-north-1 should be https://sqs.cn-north-1.amazonaws.com.cn/123456789012/my-queue.

Current Behaviour

It returns https://sqs.cn-north-1.amazonaws.com/123456789012/my-queue, which is not the SQS endpoint for the China partition, so using it with boto3 (delete_message, change_message_visibility, ...) fails. queue_url always uses amazonaws.com, so the same happens for the ISO partitions and aws-eusc. Commercial and GovCloud queues are fine.

Code snippet

from aws_lambda_powertools.utilities.data_classes import SQSEvent

event = SQSEvent({"Records": [{
    "messageId": "1",
    "body": "x",
    "eventSourceARN": "arn:aws-cn:sqs:cn-north-1:123456789012:my-queue",
    "awsRegion": "cn-north-1",
}]})
print(next(event.records).queue_url)
# https://sqs.cn-north-1.amazonaws.com/123456789012/my-queue

Possible Solution

queue_url already splits the ARN, so it can take the partition (arn_parts[1]) and use its DNS suffix (same values as botocore's partitions.json: aws-cn -> amazonaws.com.cn, aws-iso -> c2s.ic.gov, aws-iso-b -> sc2s.sgov.gov, etc.), defaulting to amazonaws.com. I have a small fix with a parametrized unit test ready and can open a PR once this is triaged.

Steps to Reproduce

  1. Install Powertools (checked on develop at c3114b6).
  2. Run the snippet above.
  3. The printed URL uses amazonaws.com instead of amazonaws.com.cn.

Did you run the reproduction yourself?

Yes, I ran it and saw the failure. (I used an AI assistant while investigating this; I ran the snippet and checked the output myself. I don't have a China-region account, so I haven't tried the URL against a live queue; the expected domain is from botocore's partition data and the AWS China endpoint docs.)

Powertools for AWS Lambda (Python) version

latest (develop c3114b6)

AWS Lambda function runtime

3.13

Packaging format used

PyPi

Debugging logs

No response

Activity

  1. boring-cyborg commented on Nov 11, 2026

    @boring-cyborg

    Thanks for opening your first issue here! We'll come back to you as soon as we can.
    In the meantime, check out the #python channel on our Powertools for AWS Lambda Discord: Invite link

  2. powertools-for-aws-oss-automation commented on Nov 11, 2026

    @powertools-for-aws-oss-automation

    Thanks for opening your first issue here! We'll come back to you as soon as we can.
    In the meantime, check out our GitHub Discussions: Join the conversation

  3. added this to the 3.41.0 milestone on Nov 15, 2026
  4. powertools-for-aws-oss-automation commented on Nov 15, 2026

    @powertools-for-aws-oss-automation

    Warning

    This issue is now closed. Please be mindful that future comments are hard for our team to see.
    If you need more assistance, please either reopen the issue, or open a new issue referencing this one.
    If you wish to keep having a conversation with other community members under this issue feel free to do so.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingevent_sourcesEvent Source Data Class utilitypending-releaseFix or implementation already in dev waiting to be released

    Type

    No type

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions