Skip to content

Adding attributes to sendMessage request raises an error #15

@hketepalli-resilient

Description

@hketepalli-resilient

When I pass in attributes to the send message request, I get an "MD5 returned by SQS does not match the calculation on the original request" error but this error is gone once I remove the attributes from the request.

I am using SqsClient (software.amazon.awssdk.services.sqs.SqsClient) to send the mock server.

Example code:

final Map<String, MessageAttributeValue> messageAttributes = new HashMap<>();

messageAttributes.put("attribute1",
  MessageAttributeValue.builder().stringValue("foo").dataType("String").build());

messageAttributes.put("attribute2",
  MessageAttributeValue.builder().stringValue("bar").dataType("String").build());

final Builder messageRequestBuilder = SendMessageRequest.builder()
  .queueUrl(queueUrl)
  .messageBody("message")
  .messageGroupId("group id")
  .messageAttributes(messageAttributes);

Error message:

software.amazon.awssdk.core.exception.SdkClientException: MD5 returned by SQS does not match the calculation on the original request. (MD5 calculated by the message attributes: "f9b03cfbe7f627a0363df39cd0698e10", MD5 checksum returned: "ac7f06e26c93a9e466e01991887b356d")
! at software.amazon.awssdk.core.exception.SdkClientException$BuilderImpl.build(SdkClientException.java:102)
! at software.amazon.awssdk.services.sqs.internal.MessageMD5ChecksumInterceptor.sendMessageOperationMd5Check(MessageMD5ChecksumInterceptor.java:122)
! at software.amazon.awssdk.services.sqs.internal.MessageMD5ChecksumInterceptor.afterExecution(MessageMD5ChecksumInterceptor.java:84)
! at software.amazon.awssdk.core.interceptor.ExecutionInterceptorChain.lambda$afterExecution$10(ExecutionInterceptorChain.java:195)
! at software.amazon.awssdk.core.interceptor.ExecutionInterceptorChain.reverseFor
...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions