Hello,
I’m trying to dynamically pass the latest version of my lambda function to update an alias for my function. However circleci keeps throwing errors when it gets to that section of the job run.
When I passed the command like so - aws lambda update-alias --function-version $LATEST_VERSION --name Production --function-name s3_lambda_fucntion, the error below comes up.
Parameter validation failed:
Invalid length for parameter FunctionVersion, value: 0, valid min length: 1
Exited with code exit status 252
And when I passed the command like so - aws lambda update-alias --function-version “$LATEST_VERSION” --name Production --function-name s3_lambda_fucntion, the error below comes up.
aws: error: argument --function-version: expected one argument
Exited with code exit status 252
Here’s some workflow snippet from my config.
jobs:
collator_build:
# build steps #
collator_deploy_production:
executor: lambda-executor
steps:
- shallow-checkout/checkout
- install_aws_cli
- run:
name: Get Latest Lambda Version
command: |
LATEST_VERSION=$(aws lambda list-versions-by-function --function-name s3_lambda_fucntion --query "Versions[-1].Version" --output text)
echo "$LATEST_VERSION"
- run:
name: Update lambda alias
command: |
aws lambda update-alias --function-version $LATEST_VERSION --name Production --function- name s3_lambda_fucntion
workflows:
jobs:
- collator_build
- collator_deploy_production
Does anyone know how I can work around this or maybe I’m missing something? Thanks.
Side Note: I tried to rerun my job from the failed workflow using SSH and had no problems running the steps to up get the latest version and update the alias from the circleci box.