-
Notifications
You must be signed in to change notification settings - Fork 15
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
MessageAttributes parsing from SNS #93
Comments
Hi @AlexanderKudryavsky thanks for reporting the bug! Would you mind submitting a PR? |
@AlexanderKudryavsky I am not sure what goes wrong here... If the queue messages are generated by SNS, then they will never by gzipped or stored in S3, you should probably not send messages yourself in the same queue an SNS can send messages in. If you do think this is a valid case, I don't see in AWS docs where the property MessageAttributes exists on the SNS message body. Can you please refer me to it? Same goes for the new way you suggest to parse attributes. |
@regevbr If I send a message to the SNS through aws sdk then MessageAttribues get into the body |
Ok I understand, can you please share with me the docs that state it? Also can you please share how such a message looks like as a JSON output (remove sensitive data ofcourse) |
@regevbr |
My SQS queue is subscribed to SNS and messages come from there |
The docs you sent does not support what you are saying is going on. |
If you look at the example of message, you can see that this structure is not expected, in |
@AlexanderKudryavsky I see but what is strange here is that the message attributes inside the unrwapped message has a different structure. |
|
https://stackoverflow.com/questions/44238656/how-to-add-sqs-message-attributes-in-sns-subscription answers describe the same strange scenario here. They do give a tip though - you can set some property called sendRaw on the subscription then the message is not wrapped... |
I understand that, but I'm asking in what scenario you will pass manually the GZIP flag? |
I check the message size, if it is more than 64 KB, then I do gzip and add an attribute, if the gzip size is more than 256 KB, then I send it to s3 and add the s3 attribute, squiss does not support sending to SNS, so I add the attributes myself |
Ok I understand. This is not recommended because the zip algorithm can change but I understand your need now. Can I ask though why not send the message to SQS then? why do you need SNS in that case? You can just send directly to the SQS queue using the tool... I added my review comments to the PR so we can continue the discussions there. |
Expected Behavior
If I receive messages with the correct attributes (__ SQS_S3__, SQS_GZIP) and with
unwrapSns: true
then it should parse my message back to its original form.Current Behavior
If I receive a message in the form gzip or s3 then the message is not parsed properly.
Possible Solution
Incorrect path in the constructor of the class Message, must be added to
if (opts.unwrapSns)
-this.attributes = attributeUtils_1.parseMessageAttributes(unwrapped.MessageAttributes);
And in
parseAttributeValue
replace with thisYour Environment
The text was updated successfully, but these errors were encountered: