-
Notifications
You must be signed in to change notification settings - Fork 597
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
Using null in AWS::Serverless::StateMachine in the ResultPath throws incorrect E0000 error #1657
Comments
Thanks for submitting this issue. For my tracking this is the translated template. This gets translated to string which masks the null to the CloudFormation service. The cfn-lint ordering may be adjust to handle this situation correctly.
|
If this remained as yaml or json (not as a string) and wasn't translated by SAM there would be a |
Hi is there any workaround for this until the bug is resolved? Other than using json! Thanks. I tried this but it doesn't stop it erroring.
|
Unfortunately, the Serverless Transform drops attributes like |
Thanks for getting back to me so quickly. Does this apply for whole template as well? I tried the below but still have the same problem:
|
Hi, With SAM v1.36.0 and SAM CLI v1.24.0 versions, we now support adding Metadata to the serverless resources. Can you verify if that will help with your use case? Thanks! |
Where are we at with this? It's 2022 and the problem still persists in CloudFormation with YAML. |
Any ETA as to when this will be fixed? it's forcing our step after our map to handle our incoming input in a remarkably awkward way |
Maybe i'm missing something, this issue is closed because there is no error thrown now, but yaml template with |
This is the template returned by running {
"rTestMachine": {
"Properties": {
"DefinitionString": {
"Fn::Join": [
"\n",
[
"{",
" \"StartAt\": \"myState\",",
" \"States\": {",
" \"myState\": {",
" \"End\": true,",
" \"Resource\": \"${definition_substitution_1}\",",
" \"ResultPath\": null,",
" \"Type\": \"Task\"",
" }",
" }",
"}"
]
]
},
"DefinitionSubstitutions": {
"definition_substitution_1": {
"Fn::GetAtt": [
"rLambda",
"Arn"
]
}
},
"RoleArn": {
"Fn::GetAtt": [
"rTestMachineRole",
"Arn"
]
},
"Tags": [
{
"Key": "stateMachine:createdBy",
"Value": "SAM"
}
]
},
"Type": "AWS::StepFunctions::StateMachine"
}
} |
Thank tou very much for your quick response! Then it's a CloudFormation error? On CF console when I see the template it is shown like this: SaveInfoToBucket:
Type: Task
ResultPath: null
Next: OtherStep
Retry:
- ErrorEquals:
- S3.SdkClientException
IntervalSeconds: 3
MaxAttempts: 3
Parameters:
Body.$: $
Bucket:
Ref: BucketId
Key.$: States.Format('{}_{}.json', $$.Execution.StartTime, $.field)
Resource: arn:aws:states:::aws-sdk:s3:putObject But if i click View processed template:
|
That is kind of baffling to me as the sam translator library from pypi will convert it to this: "DefinitionString": {
"Fn::Join": [
"\n",
[
"{",
" \"StartAt\": \"myState\",",
" \"States\": {",
" \"SaveInfoToBucket\": {",
" \"Next\": \"OtherStep\",",
" \"Parameters\": {",
" \"Body.$\": \"$\",",
" \"Bucket\": \"${definition_substitution_1}\",",
" \"Key.$\": \"States.Format('{}_{}.json', $$.Execution.StartTime, $.field)\"",
" },",
" \"Resource\": \"arn:aws:states:::aws-sdk:s3:putObject\",",
" \"ResultPath\": null,",
" \"Retry\": [",
" {",
" \"ErrorEquals\": [",
" \"S3.SdkClientException\"",
" ],",
" \"IntervalSeconds\": 3,",
" \"MaxAttempts\": 3",
" }",
" ],",
" \"Type\": \"Task\"",
" }",
" }",
"}"
]
]
}, They don't look similar this may be an issue unrelated to cfn-lint since we rely on SAM to transform the template appropriately. |
@kddejong Thank you very much again for your quick response After your response, I checked every tiny thing that might be causing this and voilà 🥳 My template uses two transformations: ---
AWSTemplateFormatVersion: 2010-09-09
Transform:
- 'AWS::LanguageExtensions'
- 'AWS::Serverless-2016-10-31' They are in the correct order as stated here: Once I removed the
I hope this is useful for someone else. |
that is useful and I wonder if its a bug in how the |
I now face the same issue when the cf is in YAML and the definition is JSON. I am unable to deploy my step function while ResultPath value is null |
@niokolra I don't think the deployment error is related to CloudFormation will throw an error if it detects This gets around the issue because behind the scenes the Serverless Transform converts the YAML specified in the |
I misread the question, ignore my previous comment 🤦 |
@niokolra can you provide a few more details. Are you using the language transform? Are you using SAM? Or is it just a CloudFormation template with a step function defined in JSON |
@kddejong this is just a CloudFormation template with a step function defined in JSON. When I try to deploy it I receive the error |
@niokolra do you get that error from the service or cfn-lint? |
Just for visibility: The underlying issue in the |
Hey, you solved it for me, I swapped to the serverless version, thanks for that. |
StateMachines allow for a null value in the ResultPath Property to pass input directly to the output
Below is a minimal example of a template that is proper but flagged as invalid
Adding quotes around null does not resolve the issue as the value of the property needs to evaluate to null. An exception for null checking should be added for this Parameter
The text was updated successfully, but these errors were encountered: