aws / aws-toolkit-visual-studio

AWS Toolkit for Visual Studio - a plugin to interact with AWS
https://aws.amazon.com/visualstudio/
Apache License 2.0
97 stars 29 forks source link

Cloudformation (Serverless Application Model - SAM) serverless.template in Visual Studio shows errors but builds and deploys #415

Open dzeidman opened 1 month ago

dzeidman commented 1 month ago

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):

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

shruti0085 commented 1 month ago

@dzeidman Thanks for bringing this issue to our attention. I was able to reproduce this issue and am investigating further