Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

AWS Lambda function update pipeline failing with "Error parsing parameter '--zip-file......' "

Ariel Mantovani May 27, 2022

Hello everyone.

I'm having a pprblem trying to set up a pipeline for update an AWS Lambda function.

Once the deploy is triggered, it fails with the following error:

Status: Downloaded newer image for bitbucketpipelines/aws-lambda-deploy:0.2.3
INFO: Updating Lambda function.
aws lambda update-function-code --function-name apikey-token-authorizer2 --publish --zip-file fileb://apiGatewayAuthorizer.zip
Error parsing parameter '--zip-file': Unable to load paramfile fileb://apiGatewayAuthorizer.zip: [Errno 2] No such file or directory: 'apiGatewayAuthorizer.zip'
✖ Failed to update Lambda function code.

Looks like the script couldn't find the artifact, but I don't know why. 

Here is the bitbucket-pipelines.yml file content:

image: node:16

# Workflow Configuration

pipelines:

default:

- parallel:

- step:

name: Build and Test

caches:

- node

script:

- echo Installing source YARN dependencies.

- yarn install

branches:

testing:

- parallel:

- step:

name: Build

script:

- apt update && apt install zip

# Exclude files to be ignored

- echo Zipping package.

- zip -r apiGatewayAuthorizer.zip . -x *.git* bitbucket-pipelines.yml

artifacts:

- apiGatewayAuthorizer.zip

- step:

name: Deploy to testing - Update Lambda code

deployment: Test

trigger: manual

script:

- pipe: atlassian/aws-lambda-deploy:0.2.3

variables:

AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID

AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY

AWS_DEFAULT_REGION: $AWS_DEFAULT_REGION

FUNCTION_NAME: $LAMBDA_FUNCTION_NAME

COMMAND: 'update'

ZIP_FILE: 'apiGatewayAuthorizer.zip'

Does anyone knows what am I missing here?
Thanks in advance.

1 answer

1 accepted

0 votes
Answer accepted
Mark C
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 29, 2022

Hi @Ariel Mantovani

Welcome to the community.

Based on your YAML configuration, I can see that you're using Parallel steps.

According to the documentation:

Parallel steps can only use artifacts produced by previous steps, not by steps in the same parallel set.

Hence, this is why the artifacts is not generated in the "Build" step because those 2 steps are within a parallel set.

For that, you can just remove the parallel configuration and use multi-steps instead.
This way, the first step can generate the artifact and pass it on to the second step.

Hope it helps and let me know how it goes.

Regards,
Mark C

Ariel Mantovani June 1, 2022

Thank you , Mark! That worked like a charm. 

Our pipeline is working and deploying to Lambda without errors.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events