Skip to content

Commit

Permalink
fix parsing of SQS incoming mail
Browse files Browse the repository at this point in the history
it _is_ double-json'd even with aws-sdk v2?

Change-Id: Ice998bdda790673378d1dd2463acb2eba862b5de
Reviewed-on: https://gerrit.instructure.com/100782
Product-Review: Cody Cutrer <[email protected]>
QA-Review: Cody Cutrer <[email protected]>
Tested-by: Cody Cutrer <[email protected]>
Reviewed-by: Jacob Fugal <[email protected]>
  • Loading branch information
ccutrer committed Jan 29, 2017
1 parent 7726eb9 commit 20e1b62
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ def unprocessed_message_count
private

def raw_contents(msg)
sns_body = JSON.parse(msg.body)
sqs_body = JSON.parse(msg.body)
sns_body = JSON.parse(sqs_body['Message'])
key = sns_body['mail']['messageId']
s3 = Aws::S3::Resource.new(access_key_id: config[:access_key_id], secret_access_key: config[:secret_access_key],
region: config[:region] || 'us-east-1')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,11 @@
let(:queue) { double }
let(:sqs_message_body) {
{
mail: {
messageId: 's3_key'
}
Message: {
mail: {
messageId: 's3_key'
}
}.to_json
}.to_json
}
let(:sqs_message) { double(body: sqs_message_body) }
Expand Down

0 comments on commit 20e1b62

Please sign in to comment.