aws / aws/aws-sam-cli

Sam local start-api doesn't handle well local layers when using nested applications

Open
#3,003 5 comments 0 reactions 0 assignees View on GitHub
area/local/start-api maintainer/need-followup type/feature
Dominant language
Python
Stars
6.7k
Forks
1.2k
Avg merge
1d 10h
Merged PRs (30d)
52

Description

I have a sam nested application with the following template structure:

template.yml
|
|-----LayerTemplate.yml
|-----ApiTemplate.yml

Api has a reference to a AWS::Serverless::LayerVersion resource created in LayerTemplate.yml , done via Output and Parameters reference.

When attempting to run locally, the functions that uses the layer return the following error:

`sam local start-api -t template.yml `

`samcli.commands.local.cli_common.user_exceptions.InvalidLayerVersionArn: SharedLayer is an Invalid Layer Arn.`

Workaround: Do a sam deploy , then get the layer arn and run locally the ApiTemplate.yml using
` sam local start-api -t ApiTemplate.yml --parameter-overrides SharedLayer=arn:aws:lambda:*:1111111:layer:shared:2`

This is not great because it creates a dependency with the AWS Arn.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.