@@ -28,7 +28,6 @@ const { createNamespace } = require('continuation-local-storage')
28
28
* https://docs.aws.amazon.com/sdkref/latest/guide/feature-retry-behavior.html
29
29
*/
30
30
const { LambdaClient, CreateFunctionCommand } = require ( '@aws-sdk/client-lambda' )
31
- const lambdaClient = new LambdaClient ( )
32
31
33
32
const maxBufferSize = 50 * 1024 * 1024
34
33
@@ -699,22 +698,7 @@ Emulate only the body of the API Gateway event.
699
698
}
700
699
701
700
_uploadNew ( lambda , params ) {
702
- if ( process . env . USE_AWS_SDK_V3 ) {
703
- console . log ( 'DEBUG: Use AWS SDK V3: CreateFunctionCommand()' )
704
- const command = new CreateFunctionCommand ( params )
705
- return lambdaClient . send ( command )
706
- }
707
-
708
- return new Promise ( ( resolve , reject ) => {
709
- const request = lambda . createFunction ( params , ( err , data ) => {
710
- if ( err ) return reject ( err )
711
- resolve ( data )
712
- } )
713
- request . on ( 'retry' , ( response ) => {
714
- console . log ( response . error . message )
715
- console . log ( '=> Retrying' )
716
- } )
717
- } )
701
+ return lambda . send ( new CreateFunctionCommand ( params ) )
718
702
}
719
703
720
704
_readArchive ( program ) {
@@ -991,6 +975,7 @@ they may not work as expected in the Lambda environment.
991
975
}
992
976
993
977
async _deployToRegion ( program , params , region , buffer ) {
978
+ // sdk v3 todo: Migration of aws.updateConfig.
994
979
aws . updateConfig ( program , region )
995
980
996
981
console . log ( '=> Reading event source file to memory' )
@@ -1004,10 +989,12 @@ they may not work as expected in the Lambda environment.
1004
989
console . log ( `=> Uploading zip file to AWS Lambda ${ region } with parameters:` )
1005
990
}
1006
991
console . log ( params )
992
+ // Migrating to v3.
1007
993
const lambda = new aws . sdk . Lambda ( {
1008
994
region,
1009
995
apiVersion : '2015-03-31'
1010
996
} )
997
+ const lambdaClient = new LambdaClient ( { region } )
1011
998
const scheduleEvents = new ScheduleEvents ( aws . sdk , region )
1012
999
const s3Events = new S3Events ( aws . sdk , region )
1013
1000
const cloudWatchLogs = new CloudWatchLogs ( aws . sdk , region )
0 commit comments