Closed cyberwombat closed 3 months ago
I just disabled the extension and I see there are still errors regarding ServerlessRestApi
which makes me think another plugin is showing error - I will close this while I fix this to see if that is the cause of the error dump.
I'm able to reproduce on the latest version of the code. The extension is calling cfn-lint and probably producing this error.
The transformed template I'm getting is. I'm not sure why I'm getting nulls for Outputs from the sam translator.
{
"Description": "My integration",
"HelloWorldApi": {
"Description": "API Gateway endpoint URL for Prod stage for Hello World function",
"Value": {
"Fn::Sub": "https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/Prod/hello/"
}
},
"Outputs": null,
"Resources": {
"TriggerFunction": {
"Metadata": {
"BuildMethod": "esbuild",
"BuildProperties": {
"EntryPoints": [
"app.ts"
],
"Minify": true,
"Target": "es2020"
}
},
"Properties": {
"Architectures": [
"x86_64"
],
"Code": {
"S3Bucket": "bucket",
"S3Key": "value"
},
"Handler": "app.lambdaHandler",
"Role": {
"Fn::GetAtt": [
"TriggerFunctionRole",
"Arn"
]
},
"Runtime": "nodejs20.x",
"Tags": [
{
"Key": "lambda:createdBy",
"Value": "SAM"
}
],
"Timeout": 180
},
"Type": "AWS::Lambda::Function"
},
"TriggerFunctionRole": {
"Metadata": {
"BuildMethod": "esbuild",
"BuildProperties": {
"EntryPoints": [
"app.ts"
],
"Minify": true,
"Target": "es2020"
}
},
"Properties": {
"AssumeRolePolicyDocument": {
"Statement": [
{
"Action": [
"sts:AssumeRole"
],
"Effect": "Allow",
"Principal": {
"Service": [
"lambda.amazonaws.com"
]
}
}
],
"Version": "2012-10-17"
},
"ManagedPolicyArns": [
"arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
],
"Tags": [
{
"Key": "lambda:createdBy",
"Value": "SAM"
}
]
},
"Type": "AWS::IAM::Role"
}
}
}
@cyberwombat based on your indentation I can see why Outputs are null. I'll update the graphing functionality to validate the Outputs before assuming its correct.
@kddejong I know... embarrassing :) After I disabled cfn-lint plugin and ran it I saw that. I was distracted by the error message regarding "ServerlessRestApi" which turns out came from a different plugin. Silly me.
Thanks
CloudFormation Lint Version
0.87.7
What operating system are you using?
macOS Sonoma 14.5
Describe the bug
It's twofold. What I am ultimately trying to do is allow the use of ServerlessRestApi in a SAM template. I am using this in VSCode and linter yields "Unable to find referenced value, 'ServerlessRestApi" for something like this:
In an attempt to fix this I have tried the following:
I am using the VSCode plugin for cfn-lint.
What I noticed was that if the template is fine then cfn-lint just exits quietly. If I run from command line I get:
No errors are printed regarding the issue such as "Unable to find referenced value, 'ServerlessRestApi'".
If I run the VSCode linter it will have errors next to these lines AND the top entry "AWSTemplateFormatVersion: '2010-09-09'" shows a warning on hover which prints the same traceback errors as above. So it seems to be working? but always dumps errors when so?
I've attempted to ignore the issue by passing the flag "--ignore-checks W" which does nothing for this error.
Additionally 'cfn-lint u' hangs forever and appears to do nothing __
Expected behavior
I'd like to lint the default SAM HelloWorld template without warnings.
Reproduction template