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

MD5 returned by SQS does not match the calculation on the original request #35

Open
tbhi opened this issue Nov 19, 2015 · 12 comments
Open

Comments

@tbhi
Copy link

tbhi commented Nov 19, 2015

I'm trying to use a java application with fake_sqs but am getting this:

Caused by: com.amazonaws.AmazonClientException: MD5 returned by SQS does not match the calculation on the original request. (MD5 calculated by the message attributes: "c3d29a3de5c6497a057496fd58a56e89", MD5 checksum returned: "null")
    at com.amazonaws.services.sqs.MessageMD5ChecksumHandler.sendMessageOperationMd5Check(MessageMD5ChecksumHandler.java:120)
    at com.amazonaws.services.sqs.MessageMD5ChecksumHandler.afterResponse(MessageMD5ChecksumHandler.java:80)
    at com.amazonaws.handlers.RequestHandler2Adaptor.afterResponse(RequestHandler2Adaptor.java:49)
    at com.amazonaws.http.AmazonHttpClient.afterResponse(AmazonHttpClient.java:416)
    at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:322)
    at com.amazonaws.services.sqs.AmazonSQSClient.invoke(AmazonSQSClient.java:2419)
    at com.amazonaws.services.sqs.AmazonSQSClient.sendMessage(AmazonSQSClient.java:1015)
    at org.apache.camel.component.aws.sqs.SqsProducer.process(SqsProducer.java:58)

I see that one of the ruby examples uses "apiVersion: '2012-11-05'" - perhaps this is required for all clients?

@georgepapas
Copy link

Any movement on this?

@ssrinivasulu
Copy link

I'm seeing the same issue, any updates?

@nathanabercrombie
Copy link

Also have this problem. fake_sqs doesn't return this at all:

 <SendMessageResponse>
    <SendMessageResult>
        <MD5OfMessageBody>740682d831a40200b5147a683bc1a7d7</MD5OfMessageBody>
        <MessageId>d7a3913a-8c91-4776-b061-dff1c4087a78</MessageId>
    </SendMessageResult>
    <ResponseMetadata>
        <RequestId>dea697d5-fbb5-4c3e-9692-ed27fa1a3d46</RequestId>
    </ResponseMetadata>
</SendMessageResponse>

And when getting the item, the attributes seem to be missing

@algorist
Copy link

algorist commented Feb 1, 2017

Has this project has been abandoned?

@tiwilliam tiwilliam changed the title works with java sdk? MD5 returned by SQS does not match the calculation on the original request Jul 22, 2017
@tiwilliam tiwilliam marked this as a duplicate of #40 Jul 22, 2017
@tiwilliam
Copy link
Contributor

@algorist No, patches are welcome if this is still an issue.

@ghost
Copy link

ghost commented Sep 8, 2018

When is this going to be fixed? This is a critical bug. I cannot use fake-sqs to send events in my development whatsoever. The issue is open from November 2015 but still no changes. People have to look for alternatives.

@tiwilliam
Copy link
Contributor

Simply when someone decides to take time to fix it. I'm using fake_sqs without hitting this bug. A first good step would be to post code/versions here to re-produce the issue.

@ghost
Copy link

ghost commented Sep 10, 2018

In Java development, it is not possible to not hit this bug. There is no code sample because it is happening behind the scenes when sending an event is prompted to happen typically in the one line of code. By default, and it can not be changed in Java AWS SQS SDK, before sending a message, SQS verifies the checksum. Fake-sqs returns null instead of valid checksum so the exception is thrown preventing to follow a standard SQS workflow.
People don't even try to do something fancy. This bug prevents from testing of message sending - the one and only purpose for which this project was created.

@tiwilliam
Copy link
Contributor

I'm in Python land, but I guess this might happen with newer versions of boto3 as well. Send message should send a correct MD5 back, but it obviously doesn't in this case:
https://github.com/iain/fake_sqs/blob/master/spec/acceptance/message_actions_spec.rb#L24

Again, if you want me to help you, I would appreciate a SDK version and a code snippet (even if just one line). This way I don't have to spend time, guessing versions, when I also have to setup a Java environment.

@tiwilliam
Copy link
Contributor

tiwilliam commented Sep 10, 2018

Does not complain in latest boto3.

Fake:

{
    u 'MD5OfMessageBody': '444bcb3a3fcf8389296c49467f27e1d6', 'ResponseMetadata': {
        'RetryAttempts': 0,
        'HTTPStatusCode': 200,
        'RequestId': '465c6a9a-3b14-4007-a628-fce678fb4280',
        'HTTPHeaders': {
            'content-length': '306',
            'x-xss-protection': '1; mode=block',
            'x-content-type-options': 'nosniff',
            'server': 'WEBrick/1.3.1 (Ruby/2.3.7/2018-03-28)',
            'connection': 'Keep-Alive',
            'date': 'Mon, 10 Sep 2018 15:48:33 GMT',
            'x-frame-options': 'SAMEORIGIN',
            'content-type': 'text/html;charset=utf-8'
        }
    }, u 'MessageId': '30adc959-9e40-4b62-bfa0-bde8ab131501'
}

Real:

{
    u 'MD5OfMessageBody': '444bcb3a3fcf8389296c49467f27e1d6', 'ResponseMetadata': {
        'RetryAttempts': 0,
        'HTTPStatusCode': 200,
        'RequestId': '<obfuscated>',
        'HTTPHeaders': {
            'x-amzn-requestid': '<obfuscated>',
            'content-length': '378',
            'server': 'Server',
            'connection': 'keep-alive',
            'date': 'Mon, 10 Sep 2018 15:50:27 GMT',
            'content-type': 'text/xml'
        }
    }, u 'MessageId': '8f30bb07-cb92-4930-b6e0-ee97bf268ab0'
}

@volgar1x
Copy link

I am getting the same issue with aws-java-sdk-sqs 1.11.362 and fake_sqs 0.3.1

@phillipgziprecruiter
Copy link

FYI: I don't use this library, but I have been struggling with a similar error when using a java client. (I found this by googling my error message). It seems that the java client does two checksums. One for the body and one for the attributes. As I have seen this problem in multiple "SQS Testing Implementations", i'm guessing the java client is doing more work than others? Anyway, calculating the MD5 on the attributes as well as the body seems to be the trick to making the java APIs happy.

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

8 participants