gabehollombe-aws / step-functions-workshop

Intro to Service Coordination with AWS Step Functions
https://step-functions-workshop.go-aws.com/
40 stars 33 forks source link

SAM launch configuration for Flag function does not pass payload to lambda #19

Open asunar opened 3 years ago

asunar commented 3 years ago

This is not an issue with code. I would like to learn why SAM is not passing payload to lambda. I have added launch configurations for both SubmitApplicationFunction and FlagApplicationFunction in Cloud9 as shown below.

Running SubmitApplicationFunction launch configuration works as expected passing the payload to lambda, however running FlagApplicationFunction launch configuration does not pass payload to lambda.

Both functions work when running with aws lambda invoke

Any ideas on what I may be doing wrong here? Thanks.

{
    "configurations": [
        {
            "type": "aws-sam",
            "request": "direct-invoke",
            "name": "workshop-dir:FlagApplicationFunction",
            "invokeTarget": {
                "target": "template",
                "templatePath": "workshop-dir/template.yaml",
                "logicalId": "FlagApplicationFunction"
            },
            "lambda": {
                "payload": {
                    "id": "application_e63632fe-d277-47be-a763-7472e0c6bd70",
                    "flagType": "REVIEW"
                },
                "environmentVariables": {
                    "APPLICATIONS_TABLE_NAME": "StepFunctionWorkshop-AccountApplications-step-functions-workshop"
                }
            }
        },
        {
            "type": "aws-sam",
            "request": "direct-invoke",
            "name": "workshop-dir:SubmitApplicationFunction",
            "invokeTarget": {
                "target": "template",
                "templatePath": "workshop-dir/template.yaml",
                "logicalId": "SubmitApplicationFunction"
            },
            "lambda": {
                "payload": {
                    "name": "Spock1234",
                    "address": "1234 Enterprise Street"
                },
                "environmentVariables": {
                    "APPLICATIONS_TABLE_NAME": "StepFunctionWorkshop-AccountApplications-step-functions-workshop"
                }
            }
        }
    ]
}
asunar commented 3 years ago

Same behavior with sam 1.18 and 1.19 sam