Skip to content

sam deploy --paramter-override for Function's Layers with Fn::Sub: fails after upgrading to version 0.48.0 fails #1958

@smurphnturf

Description

@smurphnturf

Description

A Functions Layers referenced by arn has a version look up through parameters that are provided via --parameter-override flag on sam deploy. After upgrading to latest version 0.48.0 the layers fail to substitute any parameters without default values into the layer arn. Thus deployment fails.

Steps to reproduce

AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Parameters:
LayerVersion:
Type: Number
Description: The version for the layer
Resources:
MyFunction:
Type: AWS::Serverless::Function
Properties:
CodeUri: code
Handler: index.handler
Runtime: nodejs12.x
Layers:
- Fn:Sub: arn:aws:lambda:us-west-2:11111111:layer:layer-name:${LayerVersion}

Observed result

`
Telemetry endpoint configured to be https://aws-serverless-tools-telemetry.us-west-2.amazonaws.com/metrics

Deploying with following values
===============================
Stack name                 : my-stack-name
Region                     : us-west-2
Confirm changeset          : False
Deployment s3 bucket       : my-bucket-name
Capabilities               : ["CAPABILITY_IAM"]
Parameter overrides        : {'LayerVersion': '115'}

Initiating deployment

File with same data is already exists at my-stack-name/9e7216aff9934ea2895cdb12b5f4aa33. Skipping upload
2 resources found in the template
Sending Telemetry: {'metrics': [{'commandRun': {'awsProfileProvided': False, 'debugFlagProvided': True, 'region': 'us-west-2', 'commandName': 'sam deploy', 'duration': 1197, 'exitReason': 'InvalidLayerVersionArn', 'exitCode': 1, 'requestId': '8615248c-be1a-48ca-baf9-48e230fe2ca5', 'installationId': '129e166f-e3d7-4041-88e8-db7a07f6a5ce', 'sessionId': 'a399738e-227e-435c-a53e-fd837506bbba', 'executionEnvironment': 'CLI', 'pyversion': '3.7.7', 'samcliVersion': '0.48.0'}}]}
HTTPSConnectionPool(host='aws-serverless-tools-telemetry.us-west-2.amazonaws.com', port=443): Read timed out. (read timeout=0.1)
Error: arn:aws:lambda:us-east-1:1111111:layer:layer-name:LayerVersion is an Invalid Layer Arn.
`

Expected result

successful deployment with layer arn:
arn:aws:lambda:us-west-2:1111111:layer:layer-name:115

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

  1. OS: Mac and Ubuntu
  2. sam --version: 0.48.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    stage/waiting-for-releaseFix has been merged to develop and is waiting for a release

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions