Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Publish AWS Serverless Application - Failed to create CloudFormation change set: Template Error #421

Open
ibbyu opened this issue May 13, 2024 · 1 comment
Labels
bug We can reproduce the issue and confirmed it is a bug.

Comments

@ibbyu
Copy link

ibbyu commented May 13, 2024

Describe the bug

... Waiting for change set to be reviewed
Error getting status of change set: Failed to create CloudFormation change set: Template format error: The Value field of every Outputs member must evaluate to a String and not a List

To Reproduce
Steps to reproduce the behaviour
example:

  1. Create new Serverless Application (Web Api)
  2. Add some parameters & mappings to serverless.template. Example:
Parameters:
  Environment:
    Type: String
    AllowedValues:
    - dev
    - prod
    Description: The environment. Default is dev.
    Default: dev
  SubDomainName:
    Type: String
    Description: The subdomain for Api. Default is api.
    Default: api
Mappings:
  DomainMap:
    dev:
      Name: dev.example.com
    prod:
      Name: example.com
  1. Update Output value to sub values found in DomainMap using FindInMap.
    (This gets highlighted as an error 0: Unresolved tag: !FindInMap). Example:
Outputs:
  ApiURL:
    Description: Api URL
    Value:
      Fn::Sub:
          - "https://${SubDomainName}.${DomainName}"
          - DomainName: !FindInMap [DomainMap, !Ref Environment, Name]
  1. Right click project -> Publish to AWS Lambda -> Go through options & Publish
  2. Error:
Error getting status of change set: Failed to create CloudFormation change set: Template format error: The Value field of every Outputs member must evaluate to a String and not a List

Expected behavior
Should deploy successfully. This exact same template works when using sam build & sam deploy

Screenshots
Error when using VS GUI:
image

Successful deployment after using sam build & sam deploy
image
Toolkit Logs

Development System (please complete the following information):

  • Windows Version:
  • Visual Studio Version: 17.9.6
  • AWS Toolkit for Visual Studio Version: 1.52.0.0

Additional context
This exact same template works when using sam build & sam deploy
(Update the Handler to match your project)

Description: An AWS Serverless Application that uses the ASP.NET Core framework running
  in Amazon Lambda.
Parameters:
  Environment:
    Type: String
    AllowedValues:
    - dev
    - prod
    Description: The environment. Default is dev.
    Default: dev
  SubDomainName:
    Type: String
    Description: The subdomain for Api. Default is api.
    Default: api
Mappings:
  DomainMap:
    dev:
      Name: dev.example.com
    prod:
      Name: example.com
Conditions: {}
Resources:
  AspNetCoreFunction:
    Type: AWS::Serverless::Function
    Properties:
      Handler: test::test.LambdaEntryPoint::FunctionHandlerAsync
      Runtime: dotnet8
      CodeUri: ''
      MemorySize: 512
      Timeout: 30
      Role: null
      Policies:
      - AWSLambda_FullAccess
      Events:
        ProxyResource:
          Type: Api
          Properties:
            Path: "/{proxy+}"
            Method: ANY
        RootResource:
          Type: Api
          Properties:
            Path: "/"
            Method: ANY
Outputs:
  ApiURL:
    Description: Api URL
    Value:
      Fn::Sub:
        - "https://${SubDomainName}.${DomainName}"
        - DomainName: !FindInMap [DomainMap, !Ref Environment, Name]
@ibbyu ibbyu added the bug We can reproduce the issue and confirmed it is a bug. label May 13, 2024
@rbbarad
Copy link
Contributor

rbbarad commented May 14, 2024

@ibbyu Thanks for bringing this issue to our attention. I've reproduced this on my end - there seems to be an issue with the way we are parsing the yaml formatted template file. We are currently investigating a fix for this.

In the meantime as a workaround, try converting the serverless.template file from yaml to json. Using the example you provided, I've confirmed that a json serverless.template file deploys successfully.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug We can reproduce the issue and confirmed it is a bug.
Projects
None yet
Development

No branches or pull requests

2 participants