This message was deleted.
# aws
s
This message was deleted.
b
Did you figure this out?
Having the same issue
a
Yes. We ended up using the github action to trigger a NPM script to compile the package. Then pass that into the pulumi/actions as a file archive. We never could get pulumi to reliably compile the the lamba code.
Copy code
- name: Install for the lambda code
      run: npm install
      working-directory: ./domains/lambda/code/path

    - name: Package the lambda code for development
      run: npm run package
      working-directory: ./domains/lambda/code/path 

    - name: Test if function.zip file is corrupted (dev)
      run: |
        file ./domains/lambda/code/path/dist/function.zip
        unzip -t ./domains/lambda/code/path/dist/function.zip     

    - uses: pulumi/actions@v4
      with:
        refresh: false
        command: up
       
        upsert: true
        work-dir: ./pulumi/lambdaStack/
        
      env:
        PULUMI_TOKEN: ${{ secrets.PULUMI_TOKEN }}
        LAMBDA_ARCHIVE: /home/runner/work/folders/and/domains/lambda/code/path/dist/function.zip
Here is the script in the package.json file located in the lambdaCode folder.
Copy code
"scripts": {
    "build": "mkdir -p dist && esbuild lambdaCodeFile.ts --bundle --sourcemap --platform=node --target=es2020 --outfile=dist/index.js && echo 'Build complete'",
    "package": "npm run build && (cd dist && zip function.zip index.js)",
  }
b
Yep
same
for some reason I’d get that empty zip error sporadically when using pulumi.archive and fileasset no matter how I structured my code. I assumed it was a race condition so put the archive stuff in a separate custom component resource and made the lambda function depend on it, but still had the issue
👍 1
I’m now building the zip separately from the pulumi application and am just referencing an s3 path instead
👍 1
I’ll see if I can find some time to put in an issue for this sometime next week