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

Adding attributes to sendMessage request raises an error #15

Open
hketepalli-resilient opened this issue Nov 29, 2022 · 0 comments
Open

Comments

@hketepalli-resilient
Copy link

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
...
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