Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/amazon-web-services/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/visual-studio-code/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Amazon web services AWS Lambda VScode launch.json_Amazon Web Services_Visual Studio Code_Aws Lambda - Fatal编程技术网

Amazon web services AWS Lambda VScode launch.json

Amazon web services AWS Lambda VScode launch.json,amazon-web-services,visual-studio-code,aws-lambda,Amazon Web Services,Visual Studio Code,Aws Lambda,最近,AWS在AWS VS代码工具包中引入了对SAM调试的启动配置支持 参考: 这意味着我们不能使用templates.json文件,而是需要使用launch.json将事件发送到lambda 我想向lambda函数发送一个测试事件(SQS消息)。 在引入launch configuration templates.json之前,它是这样的(并且工作得很好): 但是在launch.json中,我以以下方式粘贴了记录,这也不例外,另请参见随附的jpg屏幕截图 { "configurat

最近,AWS在AWS VS代码工具包中引入了对SAM调试的启动配置支持 参考:

这意味着我们不能使用templates.json文件,而是需要使用launch.json将事件发送到lambda

我想向lambda函数发送一个测试事件(SQS消息)。 在引入launch configuration templates.json之前,它是这样的(并且工作得很好):

但是在launch.json中,我以以下方式粘贴了记录,这也不例外,另请参见随附的jpg屏幕截图

{
"configurations": [
    {
        "type": "aws-sam",
        "request": "direct-invoke",
        "name": "xxxxxxxx)",
        "invokeTarget": {
            "target": "code",
            "projectRoot": "xxxxxxxx",
            "lambdaHandler": "xxxxxxxx.lambdaHandler"
        },
        "lambda": {
            "runtime": "nodejs12.x",
            "payload": {
                "json": {
                    "Records": [
                    {
                        "messageId": "xxxxxxxxxxxxxxxx",
                        "receiptHandle": "xxxxxxxxxxxxxxxx",
                        "body": "{\"operation\": \"publish\", \"data\": { \"__typename\": \"xxxxxxxxxxxxxxxx\", \"id\": \"xxxxxxxxxxxxxxxx\" }}",                            
                        "attributes": {
                            "ApproximateReceiveCount": "1",
                            "SentTimestamp": "xxxxxxxxxxxxxxxx",
                            "SequenceNumber": "xxxxxxxxxxxxxxxx",
                            "MessageGroupId": "xxxxxxxxxxxxxxxx",
                            "SenderId": "xxxxxxxxxxxxxxxx:LambdaFunctionTest",
                            "MessageDeduplicationId": "xxxxxxxxxxxxxxxx",
                            "ApproximateFirstReceiveTimestamp": "xxxxxxxxxxxxxxxx"
                        },
                        "messageAttributes": {            
                          "environment": {
                          "DataType": "String",
                          "stringValue": "Dev"
                        }},
                        "md5OfBody": "xxxxxxxxxxxxxxxx",
                        "eventSource": "aws:sqs",
                        "eventSourceARN": "arn:aws:sqs:us-east-1:xxxxxxxxxxxxxxxx:xxx.fifo",
                        "awsRegion": "us-east-1"
                    }
                ]
               },                    
            },
        }
    },

大宗报价


我意识到我只需要忽略错误信息,一切正常。不知道为什么vscode显示,作为某种错误,我意识到我只需要忽略错误消息,一切正常。不知道为什么vscode会将其显示为某种错误
{
"configurations": [
    {
        "type": "aws-sam",
        "request": "direct-invoke",
        "name": "xxxxxxxx)",
        "invokeTarget": {
            "target": "code",
            "projectRoot": "xxxxxxxx",
            "lambdaHandler": "xxxxxxxx.lambdaHandler"
        },
        "lambda": {
            "runtime": "nodejs12.x",
            "payload": {
                "json": {
                    "Records": [
                    {
                        "messageId": "xxxxxxxxxxxxxxxx",
                        "receiptHandle": "xxxxxxxxxxxxxxxx",
                        "body": "{\"operation\": \"publish\", \"data\": { \"__typename\": \"xxxxxxxxxxxxxxxx\", \"id\": \"xxxxxxxxxxxxxxxx\" }}",                            
                        "attributes": {
                            "ApproximateReceiveCount": "1",
                            "SentTimestamp": "xxxxxxxxxxxxxxxx",
                            "SequenceNumber": "xxxxxxxxxxxxxxxx",
                            "MessageGroupId": "xxxxxxxxxxxxxxxx",
                            "SenderId": "xxxxxxxxxxxxxxxx:LambdaFunctionTest",
                            "MessageDeduplicationId": "xxxxxxxxxxxxxxxx",
                            "ApproximateFirstReceiveTimestamp": "xxxxxxxxxxxxxxxx"
                        },
                        "messageAttributes": {            
                          "environment": {
                          "DataType": "String",
                          "stringValue": "Dev"
                        }},
                        "md5OfBody": "xxxxxxxxxxxxxxxx",
                        "eventSource": "aws:sqs",
                        "eventSourceARN": "arn:aws:sqs:us-east-1:xxxxxxxxxxxxxxxx:xxx.fifo",
                        "awsRegion": "us-east-1"
                    }
                ]
               },                    
            },
        }
    },