@@ -30,6 +30,7 @@ const { createNamespace } = require('continuation-local-storage')
30
30
const {
31
31
LambdaClient,
32
32
CreateFunctionCommand,
33
+ ListEventSourceMappingsCommand,
33
34
GetFunctionCommand,
34
35
UpdateFunctionCodeCommand,
35
36
UpdateFunctionConfigurationCommand
@@ -766,16 +767,12 @@ they may not work as expected in the Lambda environment.
766
767
return this . _zip ( program , codeDirectory )
767
768
}
768
769
769
- _listEventSourceMappings ( lambda , params ) {
770
- return new Promise ( ( resolve , reject ) => {
771
- lambda . listEventSourceMappings ( params , ( err , data ) => {
772
- if ( err ) return reject ( err )
773
- if ( data && data . EventSourceMappings ) {
774
- return resolve ( data . EventSourceMappings )
775
- }
776
- return resolve ( [ ] )
777
- } )
778
- } )
770
+ async _listEventSourceMappings ( lambda , params ) {
771
+ const data = await lambda . send ( new ListEventSourceMappingsCommand ( params ) )
772
+ if ( data && data . EventSourceMappings ) {
773
+ return data . EventSourceMappings
774
+ }
775
+ return [ ]
779
776
}
780
777
781
778
_getStartingPosition ( eventSource ) {
@@ -1009,7 +1006,7 @@ they may not work as expected in the Lambda environment.
1009
1006
FunctionName : params . FunctionName
1010
1007
} ) . promise ( ) . then ( ( ) => {
1011
1008
// Function exists
1012
- return this . _listEventSourceMappings ( lambda , {
1009
+ return this . _listEventSourceMappings ( lambdaClient , {
1013
1010
FunctionName : params . FunctionName
1014
1011
} ) . then ( ( existingEventSourceList ) => {
1015
1012
return Promise . all ( [
0 commit comments