Multi environment lambda layer hard codes environment
See original GitHub issueDescribe the bug I have two environments and have created a new lambda layer. When I add the lambda layer to a function in the first environment, the CFN template for that function injects the current environment’s layer value as a hard coded value from the env it was created in, rather than the environment that the build is/will be occurring in
Amplify CLI Version 4.29.4
To Reproduce
- Create two environments
- Add a single lambda layer to both
- Add the lambda layer to a function in environment A
- Check the output of
Layers
in function-cloudformation-template.json – the value contains a hard-coded env
Expected behavior
The string value should contain a reference to Ref:env
to pull the environment value from the current build environment rather than the environment where the layer was added to the function
Desktop (please complete the following information):
- OS: Mac
- Node Version. 10.15.3
Additional context
Issue Analytics
- State:
- Created 3 years ago
- Reactions:11
- Comments:24 (8 by maintainers)
Top Results From Across the Web
Deploying AWS Lambda Code In Different Environments
The above steps should help you set up multiple environments in AWS Lambda. We can ensure that the development URL always gets the...
Read more >Managing a multi-environment serverless architecture in AWS
Multiple stage support in SAM is still unclear and quirky, it seems difficult to manage multiple API Gateway stages and Lambda aliases in...
Read more >Best practices for working with AWS Lambda functions
Use environment variables to pass operational parameters to your function. For example, if you are writing to an Amazon S3 bucket, instead of...
Read more >Why you should not use Lambda aliases to define environments
There are many approaches to running Lambdas across logical environments, but you need to be wary of the pitfalls when using aliases.
Read more >Finding an equivalent of environment variables in AWS ...
I could set a 'LoggingEventBus' environment variable on all the lambda functions that use this layer. But that seems repetitive and error prone....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@jhockett anything else to share here? Layers are really slowing our productivity down
Hi all, we are actively looking into reworking how layer versions work in the CLI, so fixing this issue will likely either coincide or follow that update.