@@ -30,6 +30,7 @@ const { createNamespace } = require('continuation-local-storage')
3030const {
3131 LambdaClient,
3232 CreateFunctionCommand,
33+ ListEventSourceMappingsCommand,
3334 GetFunctionCommand,
3435 UpdateFunctionCodeCommand,
3536 UpdateFunctionConfigurationCommand
@@ -766,16 +767,12 @@ they may not work as expected in the Lambda environment.
766767 return this . _zip ( program , codeDirectory )
767768 }
768769
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 [ ]
779776 }
780777
781778 _getStartingPosition ( eventSource ) {
@@ -1009,7 +1006,7 @@ they may not work as expected in the Lambda environment.
10091006 FunctionName : params . FunctionName
10101007 } ) . promise ( ) . then ( ( ) => {
10111008 // Function exists
1012- return this . _listEventSourceMappings ( lambda , {
1009+ return this . _listEventSourceMappings ( lambdaClient , {
10131010 FunctionName : params . FunctionName
10141011 } ) . then ( ( existingEventSourceList ) => {
10151012 return Promise . all ( [
0 commit comments