File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed
packages/serverless-offline-sqs/src Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -93,7 +93,8 @@ class ServerlessOfflineSQS {
93
93
const streamName = this . getQueueName ( queueEvent ) ;
94
94
this . serverless . cli . log ( `${ streamName } (λ: ${ functionName } )` ) ;
95
95
96
- const { location = '.' } = this . getConfig ( ) ;
96
+ const config = this . getConfig ( ) ;
97
+ const { location = '.' } = config ;
97
98
98
99
const __function = this . service . getFunction ( functionName ) ;
99
100
@@ -114,7 +115,7 @@ class ServerlessOfflineSQS {
114
115
servicePath ,
115
116
serviceRuntime
116
117
) ;
117
- const handler = functionHelper . createHandler ( funOptions , this . getConfig ( ) ) ;
118
+ const handler = functionHelper . createHandler ( funOptions , config ) ;
118
119
119
120
const lambdaContext = new LambdaContext ( __function , this . service . provider , ( err , data ) => {
120
121
this . serverless . cli . log (
@@ -123,6 +124,13 @@ class ServerlessOfflineSQS {
123
124
cb ( err , data ) ;
124
125
} ) ;
125
126
127
+ const awsRegion = config . region || 'us-west-2' ;
128
+ const awsAccountId = config . accountId || '000000000000' ;
129
+ const eventSourceARN =
130
+ typeof queueEvent . arn === 'string'
131
+ ? queueEvent . arn
132
+ : `arn:aws:sqs:${ awsRegion } :${ awsAccountId } :${ streamName } ` ;
133
+
126
134
const event = {
127
135
Records : messages . map (
128
136
( {
@@ -140,8 +148,8 @@ class ServerlessOfflineSQS {
140
148
messageAttributes,
141
149
md5OfBody,
142
150
eventSource : 'aws:sqs' ,
143
- eventSourceARN : queueEvent . arn ,
144
- awsRegion : 'us-west-2'
151
+ eventSourceARN,
152
+ awsRegion
145
153
} )
146
154
)
147
155
} ;
You can’t perform that action at this time.
0 commit comments