You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
But to use the layers users have to replace the region in template.yaml with the region their application is in.
Similar problem: the version of the layer will change over time, users will have to manually edit template.yaml to change the version number.
Steps to reproduce the issue:
Create the following template.yaml
AWSTemplateFormatVersion: '2010-09-09'Transform: 'AWS::Serverless-2016-10-31'Resources:
MyFunction:
Type: AWS::Serverless::FunctionProperties:
FunctionName: 'my-function'CodeUri: .Handler: index.php # the name of your PHP fileRuntime: providedLayers:
- 'arn:aws:lambda:${AWS_DEFAULT_REGION}:416566615250:layer:php-72:${MY_LAYER_VERSION}'
Try to deploy or run locally
Observed result:
It doesn't work.
Expected result:
It should replace the variables in the layer name with the existing environment variables.
Also this is the result when trying to deploy with SAM:
Failed to create the changeset: Waiter ChangeSetCreateComplete failed: Waiter encountered a terminal failure state Status: FAILED. Reason: Template format error: Unresolved resource dependencies [MY_LAYER_VERSION] in the Resources block of the template
Activity
timoschilling commentedon Jan 9, 2019
have you tried this?
mnapoli commentedon Jan 10, 2019
@timoschilling yes it doesn't either
- 'arn:aws:lambda:us-east-2:416566615250:layer:php-72:9'works.
- !Sub 'arn:aws:lambda:us-east-2:416566615250:layer:php-72:${MY_LAYER_VERSION}'doesn't work, this is the result in
sam local:{ "errorType": "Runtime.ExitError", "errorMessage": "RequestId: 52fdfc07-2182-154f-163f-5f0f9a621d72 Error: Couldn't find valid bootstrap(s): [/var/task/bootstrap /opt/bootstrap]" }Also this is the result when trying to deploy with SAM:
- !Sub 'arn:aws:lambda:us-east-2:416566615250:layer:php-72:9'doesn't work either with
sam local.I think this is related to this issue: aws/aws-sam-cli#528
keetonian commentedon Jan 18, 2019
There seem to be a few issues:
AWS_DEFAULT_REGIONis not a CFN parameter, but could be user defined. The corresponding CFN parameter isAWS::RegionMY_LAYER_VERSIONwasn't defined in the parameters section of the template you supplied.!Subin order to resolve these parametersThe following template should work (provided that the layer arn is valid):
mnapoli commentedon Jan 19, 2019
Thank you so much!
It works when deploying to AWS, however it doesn't work with
sam local. I guess this is now an issue to follow at aws/aws-sam-cli#528