简体   繁体   English

CloudFormation YAML State 机器:无法识别令牌的 INVALID_JSON_DESCRIPTION

[英]CloudFormation YAML State Machine: INVALID_JSON_DESCRIPTION for unrecognized token

I have the following code to deploy a Step Functions State Machine using CloudFormation:我有以下代码使用 CloudFormation 部署 Step Functions State 机器:

...
DefinitionString: 
        !Sub
          - |
            {
              "StartAt": "Save Artifact to S3",
              "States": {
                "Save Artifact to S3": {
                  "Type": "Task",
                  "Resource": ${lambdaArn},
                  "Next": "Format Notification"
                },
                "Format Notification": {
                  "Type": "Task",
                  "Resource": ${lambda2Arn},
                  "Next": "Publish to SNS"
                },
                "Publish to SNS": {
                  "Type": "Task",
                  "Resource": "arn:aws:states:::sns:publish",
                  "Parameters": {
                    "TopicArn": ${snsArn},
                    "Message.$": "$.message",
                    "Subject.$": "$.subject"
                  },
                  "End": true
                }
              }
            }
          - lambdaArn: !GetAtt SavetoS3Function.Arn
            lambda2Arn: !GetAtt NotifyUserFunction.Arn
            snsArn: !Ref NotifyUserTopic
...

Using SAM to deploy on AWS, I get the following error:使用 SAM 在 AWS 上部署,出现以下错误:

Invalid State Machine Definition: 'INVALID_JSON_DESCRIPTION: Unrecognized token 'arn': was expecting ('true', 'false' or 'null')  at [Source: (String)...

Everything else looks correct, so what is going on here?其他一切看起来都是正确的,那么这里发生了什么? All the Arns are being referred correctly inside the Definition String, so that's probably not the issue.所有 Arns 都在定义字符串中被正确引用,所以这可能不是问题所在。

This should be a json, so lambdaArn , lambda2Arn and snsArn should be in quotations :这应该是 json,所以lambdaArnlambda2ArnsnsArn应该在引号中:

        {
          "StartAt": "Save Artifact to S3",
          "States": {
            "Save Artifact to S3": {
              "Type": "Task",
              "Resource": "${lambdaArn}",
              "Next": "Format Notification"
            },
            "Format Notification": {
              "Type": "Task",
              "Resource": "${lambda2Arn}",
              "Next": "Publish to SNS"
            },
            "Publish to SNS": {
              "Type": "Task",
              "Resource": "arn:aws:states:::sns:publish",
              "Parameters": {
                "TopicArn": "${snsArn}",
                "Message.$": "$.message",
                "Subject.$": "$.subject"
              },
              "End": true
            }
          }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法将请求正文解析为 json:无法识别的令牌 - Could not parse request body into json: Unrecognized token 在 cloudformation 中的 yaml 中的 json 中使用 Fn::ImportValue - use Fn::ImportValue inside a json which is inside a yaml in cloudformation aws api 网关返回无法将负载解析为 json 无法识别的令牌 - aws api gateway return Could not parse payload into json Unrecognized token Cloudformation YAML 自定义变量 - Cloudformation YAML custom variable 解析 loadbalancer.yaml 时出错:将 YAML 转换为 JSON 时出错:yaml:第 4 行:找到无法启动任何令牌的字符 - error parsing loadbalancer.yaml: error converting YAML to JSON: yaml: line 4: found character that cannot start any token cloudformation 说“无效字符” - cloudformation says "invalid character" 空手道 API 测试 - Bearer error="invalid_token", error_description="观众<number>是无效的”</number> - Karate API Test - Bearer error="invalid_token", error_description="The audience <number> is invalid" 将 CloudFormation 模板 (yaml) 转换为 cdk python 代码 - Convert CloudFormation template (yaml) to cdk python code CDK/Cloudformation 共享 state - CDK/Cloudformation shared state k8s:将 YAML 转换为 JSON 时出错:yaml:第 33 行:找到无法启动任何标记的字符 - k8s: error converting YAML to JSON: yaml: line 33: found character that cannot start any token
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM