Skip to content

Commit

Permalink
fix: await promise
Browse files Browse the repository at this point in the history
  • Loading branch information
dnalborczyk committed Jun 23, 2022
1 parent 257524c commit d01d3e3
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/lambda/LambdaFunction.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,11 @@ export default class LambdaFunction {
)

this.#artifact = functionDefinition.package?.artifact

if (!this.#artifact) {
this.#artifact = service.package?.artifact
}

if (this.#artifact) {
// lambda directory contains code and layers
this.#lambdaDir = join(
Expand Down Expand Up @@ -234,15 +236,15 @@ export default class LambdaFunction {
// https://github.com/serverless/serverless/blob/v1.57.0/lib/plugins/aws/invokeLocal/index.js#L312
async #extractArtifact() {
if (!this.#artifact) {
return null
return
}

emptyDir(this.#codeDir)
await emptyDir(this.#codeDir)

const data = await readFile(this.#artifact)
const zip = await jszip.loadAsync(data)

return Promise.all(
await Promise.all(
entries(zip.files).map(async ([filename, jsZipObj]) => {
const fileData = await jsZipObj.async('nodebuffer')
if (filename.endsWith('/')) {
Expand Down

0 comments on commit d01d3e3

Please sign in to comment.