This is an automated email from the ASF dual-hosted git repository.
vincbeck pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new e3d73387658 fix(amazon): extend SQS QUEUE_REGEXP to match AWS China
endpoints (#65173)
e3d73387658 is described below
commit e3d73387658b3bb4fe8fa348c019296ee4d75b85
Author: Ali Asghar <[email protected]>
AuthorDate: Tue Apr 14 19:09:37 2026 +0500
fix(amazon): extend SQS QUEUE_REGEXP to match AWS China endpoints (#65173)
The QUEUE_REGEXP only matched standard amazonaws.com domains, causing
SqsMessageQueueProvider.queue_matches() to return False for China region
queue URLs (amazonaws.cn). Added amazonaws.cn as an alternate domain in
the regex to support cn-north-1 and cn-northwest-1 regions.
Fixes #65128
Signed-off-by: Ali <[email protected]>
---
providers/amazon/src/airflow/providers/amazon/aws/queues/sqs.py | 2 +-
providers/amazon/tests/unit/amazon/aws/queues/test_sqs.py | 5 +++++
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/providers/amazon/src/airflow/providers/amazon/aws/queues/sqs.py
b/providers/amazon/src/airflow/providers/amazon/aws/queues/sqs.py
index 6ae8a00b7c9..8d671395766 100644
--- a/providers/amazon/src/airflow/providers/amazon/aws/queues/sqs.py
+++ b/providers/amazon/src/airflow/providers/amazon/aws/queues/sqs.py
@@ -33,7 +33,7 @@ if TYPE_CHECKING:
from airflow.triggers.base import BaseEventTrigger
# [START queue_regexp]
-QUEUE_REGEXP = r"^https://sqs\.[^.]+\.amazonaws\.com/[0-9]+/.+"
+QUEUE_REGEXP = r"^https://sqs\.[^.]+\.(amazonaws\.com|amazonaws\.cn)/[0-9]+/.+"
# [END queue_regexp]
diff --git a/providers/amazon/tests/unit/amazon/aws/queues/test_sqs.py
b/providers/amazon/tests/unit/amazon/aws/queues/test_sqs.py
index 6e5c4b46a3e..486e8c955b8 100644
--- a/providers/amazon/tests/unit/amazon/aws/queues/test_sqs.py
+++ b/providers/amazon/tests/unit/amazon/aws/queues/test_sqs.py
@@ -35,10 +35,15 @@ def test_message_sqs_queue_matches():
from airflow.providers.amazon.aws.queues.sqs import SqsMessageQueueProvider
provider = SqsMessageQueueProvider()
+ # Standard AWS regions
assert
provider.queue_matches("https://sqs.us-east-1.amazonaws.com/123456789012/my-queue")
assert not
provider.queue_matches("https://sqs.us-east-1.amazonaws.com/123456789012")
assert not
provider.queue_matches("https://sqs.us-east-1.amazonaws.com/123456789012/")
assert not provider.queue_matches("https://sqs.us-east-1.amazonaws.com/")
+ # AWS China regions (cn-north-1, cn-northwest-1)
+ assert
provider.queue_matches("https://sqs.cn-north-1.amazonaws.cn/123456789012/my-queue")
+ assert
provider.queue_matches("https://sqs.cn-northwest-1.amazonaws.cn/123456789012/my-queue")
+ assert not
provider.queue_matches("https://sqs.cn-north-1.amazonaws.cn/123456789012")
@pytest.mark.parametrize(