簡體   English   中英

VS 2019 AWS Serverless.Template 解析錯誤

[英]VS 2019 AWS Serverless.Template Parse Error

下午,嘗試使用aws工具包和servless.template創建一個lambda,按計划觸發並將數據插入sqs存儲桶。 一切都很好,除了“事件”行。 我收到一條錯誤消息,顯示“第 24 行解析錯誤”。 我已經檢查、仔細檢查並驗證了波浪線支架的位置,但沒有 go。 根據 aws 文檔,我應該能夠在 lambda 定義中建立事件。

任何幫助深表感謝。 這是我的代碼。 參數化為應用程序將通過 azure 在多個環境中部署。

{
"AWSTemplateFormatVersion": "2010-09-09",
  "Transform": "AWS::Serverless-2016-10-31",
  "Description": "An AWS Serverless Application.",
  "Parameters":{
    "AwsRole" : { "Description" : "Role for lambda expression", "Type": "String"},
    "SecurityGroup" : { "Description" : "List of secuirty group ids, comma delimited", "Type" : "List<String>" },
    "SubNets" : { "Description" : "List of subnet ids, comma delimited", "Type" : "List<String>" },
    "Schedule" : {"Description" : "Cron schedule", "Type" : "String"}
  },
  "Resources": {
    "PopulateQueue": {
      "Type": "AWS::Serverless::Function",
      "Properties": {
        "Handler": "SendToQueue::SendToQueue.PopulateSqs::RunPopulate",
        "Runtime": "dotnetcore3.1",
        "CodeUri": "",
        "MemorySize": 256,
        "Role" : {"Ref" : "AwsRole"},
        "VpcConfig" : {           
            "SecurityGroupIds" : { "Ref" : "SecurityGroup" } ,
            "SubnetIds" : { "Ref" : "SubNets"}
         }   
error here--->"Events": {
          "Trigger":{
            "Type": "Schedule"
            "Properties" : {
                "Schedule" : { "Ref" : "Schedule" },
                "Name" : "PopulateSqsSchedule",
                "Description" : "Schedule for sending items to sqs",
                "Enabled" : false
            }
          }
            
        }
      }
    },
    "SendQueue": {
        "Type": "AWS::SQS::Queue",
        "Properties": {
            "ContentBasedDeduplication": true,
            "MessageRetentionPeriod": 1200,
            "QueueName": "SendQueue"
        }
    }

    }
  }
}

看起來在第 23 行你有一個錯字丟失,}之后。 在第 26 行也缺少,

通常使用一些在線工具驗證您的 JSON 非常有用,它可以快速幫助您了解錯誤。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM