Closed DwayneCoussement closed 3 years ago
Can one of the admins verify this patch?
Can one of the admins verify this patch?
Can one of the admins verify this patch?
Can one of the admins verify this patch?
Can one of the admins verify this patch?
Can one of the admins verify this patch?
@swift-server-bot test this please
seems reasonable to me.
@DwayneCoussement can you elaborate on
Note that after further research I also noticed that this is not sufficient:
- UnsubscribeUrl is transformed to UnsubscribeURL
- SigningCertUrl is transformed to SigningCertURL
Sure thing; so imagine having following simplified setup, this is just as a reference, so sorry if there are some mistakes in there:
const topic = new sns.Topic(this, 'MyTopic', {
displayName: 'Topic'
});
const queue = new sqs.Queue(this, "MyQueue", {
queueName: 'MyQueue'
});
const myIntegration = new AwsIntegration({
service: 'sns',
path: `${myAccount}/${topic.topicArn}`,
integrationHttpMethod: 'POST',
options: {
credentialsRole: myCredentials,
passthroughBehavior: PassthroughBehavior.NEVER,
requestParameters: {
'integration.request.header.Content-Type': "'application/x-www-form-urlencoded'"
},
requestTemplates: {
'application/json':
"Action=Publish" +
`&TopicArn=$util.urlEncode('${topic.topicArn}')` +
"&Message=$util.urlEncode($input.body)"
},
integrationResponses: [
{
statusCode: "200",
responseTemplates: {
"application/json": `{"statusCode": 200}`,
},
},
],
}
});
const api = new RestApi(this, "myGateway", {
apiKeySourceType: ApiKeySourceType.HEADER,
});
const testMethod = api.root.addResource('test');
testMethod.addMethod('POST', myIntegration, { apiKeyRequired: true, methodResponses: [{ statusCode: "200" }] })
topic.addSubscription(new subs.SqsSubscription(queue));
myLambda.addEventSource(new SqsEventSource(queue));
Notice that if you check the contents of the SQS records, some kind of transform happened on the original SNS message.
MessageAttributes in the above example, these will not be set, so this is the initial fix.
Notice as well that somehow SigningCertUrl
is now SigningCertURL
and UnsubscribeUrl
is now UnsubscribeURL
. I haven't looked yet in how and if we should fix this. Any suggestions from your side?
seems reasonable to me.
@DwayneCoussement can you elaborate on
Note that after further research I also noticed that this is not sufficient:
- UnsubscribeUrl is transformed to UnsubscribeURL
- SigningCertUrl is transformed to SigningCertURL
MessageAttributes in the above example, these will not be set, so this is the initial fix. Notice as well that somehow SigningCertUrl is now SigningCertURL and UnsubscribeUrl is now UnsubscribeURL. I haven't looked yet in how and if we should fix this. Any suggestions from your side?
I assume AWS may be doing some transformation. cc @bmoffatt
@swift-server-bot test this please
Make MessageAttributes optional on SNS.Message
Motivation:
When testing the following situation: SNS Topic => SQS Queue => Lambda
Notice that you'll see that SQS will have an SNS Message in the body without MessageAttributes
Note that after further research I also noticed that this is not sufficient:
Modifications:
Result:
MessageAttributes will be optional, and you'll be able to parse an SNS Message in the situation described in the motivation