Skip to content

Conversation

@cuducos
Copy link

@cuducos cuducos commented Nov 4, 2025

After #2300, MessageAttributeNames and MessageSystemAttributeNames had None as default values, but None is not a valid value for those fields. See:

https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/sqs/client/receive_message.html

This commit suggests adding ['All'] as the new default value for those fields following the error message below and the docs above.

Closes #2403

After celery#2300, `MessageAttributeNames` and `MessageSystemAttributeNames`
had `None` as default values, but `None` is not a valid value for those
fields. See:

https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/sqs/client/receive_message.html

This commit suggests adding `['All']` as the new default value for those
fields following the error message below and the docs above.

Closes celery#2403
Copy link
Member

@auvipy auvipy left a comment

Choose a reason for hiding this comment

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

can you also add additional tests to verify the change?

@codecov
Copy link

codecov bot commented Nov 4, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.16%. Comparing base (ecbb733) to head (f638d84).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2405   +/-   ##
=======================================
  Coverage   81.16%   81.16%           
=======================================
  Files          77       77           
  Lines        9719     9719           
  Branches     1095     1095           
=======================================
  Hits         7888     7888           
  Misses       1625     1625           
  Partials      206      206           

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

@cuducos
Copy link
Author

cuducos commented Nov 4, 2025

can you also add additional tests to verify the change?

It is tricky because the test uses a mock class for the queue object (the one receiving these attributes in a message_receive call). Thought on f4d6c0c?

@auvipy
Copy link
Member

auvipy commented Nov 5, 2025

the tests seems to be failing as assertion error

@auvipy
Copy link
Member

auvipy commented Nov 6, 2025

still some failing test t/unit/transport/test_SQS.py::test_Channel::test_messages_to_python FAILED [ 47%]

=================================== FAILURES ===================================
_____________________ test_Channel.test_messages_to_python _____________________

self = <t.unit.transport.test_SQS.test_Channel object at 0x7fcb024e7ec0>

def test_messages_to_python(self):
    from kombu.asynchronous.aws.sqs.message import Message

    kombu_message_count = 3
    json_message_count = 3
    # Create several test messages and publish them
    for i in range(kombu_message_count):
        message = 'message: %s' % i
        self.producer.publish(message)

    # json formatted message NOT created by kombu
    for i in range(json_message_count):
        message = {'foo': 'bar'}
        self.channel._put(self.producer.routing_key, message)

    q_url = self.channel._new_queue(self.queue_name)
    # Get the messages now
    kombu_messages = []
  for m in self.sqs_conn_mock.receive_message(
            QueueUrl=q_url,
            MaxNumberOfMessages=kombu_message_count)['Messages']:

t/unit/transport/test_SQS.py:532:


self = <t.unit.transport.test_SQS.SQSClientMock object at 0x7fcadaf81b50>
QueueUrl = 'https://sqs.us-east-1.amazonaws.com/xxx/unittest'
MaxNumberOfMessages = 3, WaitTimeSeconds = 10, MessageAttributeNames = None
MessageSystemAttributeNames = None

def receive_message(
    self,
    QueueUrl=None,
    MaxNumberOfMessages=1,
    WaitTimeSeconds=10,
    MessageAttributeNames=None,
    MessageSystemAttributeNames=None
):
  assert isinstance(MessageAttributeNames, (list, tuple))

E AssertionError: assert False
E + where False = isinstance(None, (<class 'list'>, <class 'tuple'>))

t/unit/transport/test_SQS.py:131: AssertionError
=============================== warnings summary ===============================
.tox/3.12-unit/lib/python3.12/site-packages/coverage/inorout.py:473
/home/runner/_work/kombu/kombu/.tox/3.12-unit/lib/python3.12/site-packages/coverage/inorout.py:473: CoverageWarning: --include is ignored because --source is set (include-ignored); see https://coverage.readthedocs.io/en/7.11.0/messages.html#warning-include-ignored
self.warn("--include is ignored because --source is set", slug="include-ignored")

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
--------- generated xml file: /home/runner/_work/kombu/kombu/junit.xml ---------
=========================== short test summary info ============================
SKIPPED [1] t/unit/transport/test_librabbitmq.py:7: could not import 'librabbitmq': No module named 'librabbitmq'
SKIPPED [1] t/unit/test_connection.py:117: TODO: urllib cannot parse ipv6 urls
!!!!!!!!!!!!!!!!!!!!!!!!!! stopping after 1 failures !!!!!!!!!!!!!!!!!!!!!!!!!!!
============= 1 failed,

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.

SQS transport failing with no MessageAttributeNames

2 participants