diff --git a/lib/plugins/aws/package/compile/events/sns/index.js b/lib/plugins/aws/package/compile/events/sns/index.js index ac2f0318800..9b41dcf3bd8 100644 --- a/lib/plugins/aws/package/compile/events/sns/index.js +++ b/lib/plugins/aws/package/compile/events/sns/index.js @@ -118,9 +118,11 @@ class AwsCompileSNSEvents { targetUrl = { 'Fn::Join': [ '', - `https://sqs.${deRegion}.`, - { Ref: 'AWS::URLSuffix' }, - `/${deAccount}/${deQueueName}`, + [ + `https://sqs.${deRegion}.`, + { Ref: 'AWS::URLSuffix' }, + `/${deAccount}/${deQueueName}`, + ], ], }; } else if (deadLetterTargetRef) { diff --git a/lib/plugins/aws/package/compile/events/sns/index.test.js b/lib/plugins/aws/package/compile/events/sns/index.test.js index 4e74f0aa514..286bd0b0eea 100644 --- a/lib/plugins/aws/package/compile/events/sns/index.test.js +++ b/lib/plugins/aws/package/compile/events/sns/index.test.js @@ -591,6 +591,23 @@ describe('AwsCompileSNSEvents', () => { awsCompileSNSEvents.serverless.service.provider.compiledCloudFormationTemplate.Resources .Topic1ToFirstDLQPolicy.Type ).to.equal('AWS::SQS::QueuePolicy'); + expect( + awsCompileSNSEvents.serverless.service.provider.compiledCloudFormationTemplate.Resources + .Topic1ToFirstDLQPolicy.Properties.Queues + ).to.deep.equal([ + { + 'Fn::Join': [ + '', + [ + 'https://sqs.us-east-1.', + { + Ref: 'AWS::URLSuffix', + }, + '/11111111111/myDLQ', + ], + ], + }, + ]); }); it('should link topic to corresponding dlq when redrivePolicy is defined with resource ref', () => {