-
Notifications
You must be signed in to change notification settings - Fork 0
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
Spaces in SQS message cause signature failure #13
Comments
Yep, I can confirm the problem with spaces. Currently I am using base64 encode/decode for body of the messages, and using workaround with On the other side this library is fantastic ! I was able to process and send 2 mil msg with average speed 5964 m/s Regards, |
@josheschulz @xZanon thank you for your feedback! I'll test it myself and try to find a better solution. In my internal project I use a serialized JSON object |
@josheschulz I think it's a requirement from Amazon:
So they actually expect string to be a serialized JSON or XML inside. In my implementation I made it a string because I don't know whether it a JSON or XML. So I think in your code - just do the following: response = await client.send_message(
queue_url=queue_url,
message_body=json.dumps({"demo": 1, "key": "value"}),
delay_seconds=0,
) |
I tested it locally using another SQS provider (https://cloud.vk.com/en/) and I cannot reproduce it there. I tested both with Python 3.8 and Python 3.11. message_body="a b c d", In both cases signature is worked well: {'MessageId': '2d6c0bd6-0b42-4f5a-adff-75a9e0da58ea', 'MD5OfMessageBody': '862f1b21a1366234d6c189166dcb5011'}
[{'MD5OfBody': '862f1b21a1366234d6c189166dcb5011', 'Body': 'a b c d', 'ReceiptHandle': '1703167200-2d6c0bd6-0b42-4f5a-adff-75a9e0da58ea', 'MessageId': '2d6c0bd6-0b42-4f5a-adff-75a9e0da58ea'}] |
Hi @d3QUone ,
return error :
same with :
The only working combination in my case is :
I think @josheschulz has the same problem. Let me know if there any additional debug info, or var dumps I could provide . Regards, |
Hi again, maybe I am wrong, but I think, that issue could be that you are calculating headers by using default https://docs.aiohttp.org/en/stable/client_quickstart.html
Just for testing purposes, changing line 72 like :
Works for me. I think the best solution would be to keep the same I hope this could help to solve this issue in our case. Regards, |
Hello @d3QUone and Happy new Year ! Now back to the issue. After some investigation looks like I do not like to push on this, but could we expect fix in the near feature, or should we adopt the package internally and modify it to work for us? Kind Regards, ... |
Hi @xZanon! Happy New Year! Update:
|
Hi, @d3QUone , Happy to report that the patch is working in our case with AWS. Great job !!! |
Good news! I'll release and publish the new version of the lib soon! |
Python 3.8
aiosqs==1.0.3
Results in:
If you change the message to "message__with_a_space" and it posts correctly.
This is primarily a problem if you want to do something like:
message_body=json.dumps(some_python_object)
But you can work around that (assuming no spaces in your json) by doing the following:
json.dumps(some_python_object,separators=(',', ':'))
The text was updated successfully, but these errors were encountered: