aws / aws/aws-toolkit-visual-studio

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

Open
#421 1 comment 0 reactions 0 assignees View on GitHub
bug
Dominant language
No language data
Stars
135
Forks
37
PR merge metrics
No merged PRs in 30d

Description

**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
```
3. 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]
```
4. Right click project -> Publish to AWS Lambda -> Go through options & Publish
5. 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](https://github.com/aws/aws-toolkit-visual-studio/assets/74113881/e94e5464-8918-44ac-bf7d-206de6c6977d)

Successful deployment after using `sam build` & `sam deploy`
![image](https://github.com/aws/aws-toolkit-visual-studio/assets/74113881/b7ade1cc-e126-4c6c-9268-1a78c4bb9df1)
**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]
```

Contributor guide

Open the contributing guide

Research direction

Start with the serverless.template example and the Visual Studio “Publish to AWS Lambda” path, then compare its handling of the Outputs, Fn::Sub, and FindInMap values with `sam build` and `sam deploy`. Done means the same template publishes successfully through the Visual Studio GUI without the CloudFormation change-set error.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws
Domain
cloud, devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.