Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

send_message_batch() fails when each message is below DEFAULT_MESSAGE_SIZE_THRESHOLD but in total are greater than 262144 #25

Open
bweisscyberark opened this issue Jan 8, 2025 · 0 comments

Comments

@bweisscyberark
Copy link

bweisscyberark commented Jan 8, 2025

Description

When attempting to send a batch of messages where each message is below the DEFAULT_MESSAGE_SIZE_THRESHOLD but the total size exceeds 262144 bytes, boto3 sqs client's send_message_batch() function fails with a BatchRequestTooLong error.

Steps to Reproduce

  1. Initialize the SQS client with large payload support:
import boto3
import sqs_extended_client
sqs_client: SQSClient = boto3.client('sqs')
sqs_client.large_payload_support = 'my_bucket_name'
queue_url = 'my_queue_url'
  1. Attempt to send a batch of messages, each below the size threshold, but whose total size is above the size threshold:
sqs_client.send_message_batch(QueueUrl=queue_url, Entries=[{'Id': '1','MessageBody':'A'*200000}, {'Id': '2','MessageBody':'B'*200000}])

Expected Behavior

The batch of messages should be sent successfully.

Actual Behavior

The operation fails with the following error:
{BatchRequestTooLong}BatchRequestTooLong('An error occurred (AWS.SimpleQueueService.BatchRequestTooLong) when calling the SendMessageBatch operation: Batch requests cannot be longer than 262144 bytes. You have sent 400000 bytes.')

Additional Information

Just to verify all is configured properly on my setup, sending the large messages does work as intended, via the s3 bucket:

sqs_client.send_message_batch(QueueUrl=queue_url, Entries=[{'Id': '1','MessageBody':'A'*400000}])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant