aws / aws/aws-toolkit-visual-studio
Cloudformation (Serverless Application Model - SAM) serverless.template in Visual Studio shows errors but builds and deploys
- Dominant language
- No language data
- Stars
- 135
- Forks
- 37
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the bug**
There are a number of errors shown when adding entries into a serveless.template json file. These entries are all valid according to the documentation and the template builds and deploys correctly but there are red squiggly error marks shown in the json file.
**To Reproduce**
There are a number of incorrect syntax errors. One such example is with the following resource:
```
"MySQLUserDBCluster": {
"Type":"AWS::RDS::DBCluster",
"Properties": {
"DBClusterIdentifier": "UserDBCluster",
"MasterUsername": "atadmin",
"MasterUserPassword": {
"Ref": "MasterMySQLPassword"
},
"EngineVersion": "8.0",
"Engine" : "aurora-mysql",
"EngineMode" : "provisioned",
"ServerlessV2ScalingConfiguration": {
"MaxCapacity": 20,
"MinCapacity": 1
},
"VpcSecurityGroupIds": [
{
"Ref": "MySecurityGroup"
}
]
}
},
```
the lines
```
"ServerlessV2ScalingConfiguration": {
"MaxCapacity": 20,
"MinCapacity": 1
```
are shown to be in error. When I hover over "ServerlessV2ScalingConfiguration" it says "ServerlessV2ScalingConfiguration key is invalid for this object"
The same goes for the reference to MySecurityGroup. Hovering over it, It says "MySecurityGroup is an invalid type for this reference". However, it is not and it works fine.
**Expected behavior**
I would expect the code to show correct syntax. The items should appear in the intellisence dropdowns and should resolve without a red squiggly line.
**Development System (please complete the following information):**
- Windows Version: 11 Pro version 10.0.22631
- Visual Studio Version: Professional 2022, version 17.9.5
- AWS Toolkit for Visual Studio Version: 1.50.0.0
**Additional context**
This was first submitted on AWS re:Post here: [https://repost.aws/questions/QUNhx2zUN1RN2ZNjhCQ1RH7A/cloudformation-serverless-application-model-sam-serverless-template-in-visual-studio-shows-errors-but-builds-and-deploys](url)
Contributor guide
Research direction
Reproduce the diagnostics in serverless.template using Visual Studio 2022 17.9.5 and AWS Toolkit 1.50.0.0, starting with the AWS::RDS::DBCluster example and the MySecurityGroup reference. Done means valid SAM or CloudFormation properties appear in IntelliSense and valid references no longer show red squiggles while builds and deploys continue to work.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws
- Domain
- cloud, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100