question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

sam build fails when providing a function LayerArn with a reference to a SSM::Parameter CF param

See original GitHub issue

Description

When running sam build on a template that includes a Serverless::Function resource that specifies a LayerArn property with a reference to a CF Parameter name that is of Type AWS::SSM::Parameter<string> with a default value of the name of the param in param store, sam build reports an invalid Arn.

Steps to reproduce

  1. git clone https://github.com/ericallam/sam-build-ssm-parameter-layer-arn-issue.git
  2. cd sam-build-ssm-parameter-layer-arn-issue
  3. sam build --debug

Observed result

View debug output here

Expected result

sam build should resolve the actual value of the param in param store and use that to determine if the LayerArn is valid.

Additional environment details (Ex: Windows, Mac, Amazon Linux etc)

  1. OS: macOS Mojave
  2. sam --version: 0.13.0

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:14
  • Comments:35 (8 by maintainers)

github_iconTop GitHub Comments

10reactions
chizoucommented, Jul 25, 2019

I get that using --parameter-overrides works, but it’s a really non-intuitive way to need to get sam build to work when we want to pass any AWS::SSM parameter types.

It may make sense for sam build to ignore some validation. To build, we don’t need this Ref resolved.

This is exactly how it should behave if the Ref is an AWS::SSM::* parameter. I would imagine a reasonable person wouldn’t expect the parameter value be resolved at build time. Or at the very least, if sam build detects this type of parameter, it should output some kind of warning about needing to use a --parameter-override to pass the validation.

Otherwise, one has to search Github issues to find this solution.

5reactions
obsequiouswoecommented, Jun 19, 2020

For clarity for anyone else fighting this bug the following literally got me working:

sam build --parameter-overrides param1=arn:::::::1 param2=arn:::::::1

Read more comments on GitHub >

github_iconTop Results From Across the Web

sam build fails when providing a function LayerArn with a ...
When running sam build on a template that includes a Serverless::Function resource that specifies a LayerArn property with a reference to a ...
Read more >
Invalid Layer Arn Error when using ARN value from SSM ...
It seems, SAM doesn't resolve SSM parameters. Please try using --parameter-overrides option. Example: sam build --parameter-overrides ...
Read more >
terraform-aws-modules/lambda/aws
Terraform module, which takes care of a lot of AWS Lambda/serverless tasks (build dependencies, packages, updates, deployments) in countless ...
Read more >
Invoking AWS Lambda functions locally using AWS SAM CLI
Learn how to invoke AWS Lambda functions on your machine using AWS SAM CLI. ... The AWS Serverless Application Model extends AWS CloudFormation...
Read more >
Invalid Layer Arn Error When Using Arn Value From ... - ADocLib
Reference Variables using the SSM Parameter Store. ... If you provide a RESOURCELOGICALID then AWS SAM builds only that resource.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found