Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
this.context.status('Deploying Dependencies')
this.context.debug(`Packaging lambda code from ${config.code}.`)
this.context.debug(`Uploading dependencies as a layer for lambda ${config.name}.`)
const promises = [pack(config.code, config.shims, false), layer(layerInputs)]
const res = await Promise.all(promises)
config.zipPath = res[0]
config.layer = res[1]
} else {
this.context.status('Packaging')
this.context.debug(`Packaging lambda code from ${config.code}.`)
config.zipPath = await pack(config.code, config.shims)
}
config.hash = await utils.hashFile(config.zipPath)
let deploymentBucket
if (config.bucket) {
deploymentBucket = await this.load('@serverless/aws-s3')
}
const prevLambda = await getLambda({ lambda, ...config })
if (!prevLambda) {
if (config.bucket) {
this.context.debug(`Uploading ${config.name} lambda package to bucket ${config.bucket}.`)
this.context.status(`Uploading`)
await deploymentBucket.upload({ name: config.bucket, file: config.zipPath })
}