Skip to content

(stepfunctions-tasks): LambdaInvoke - explicit null is not passed to lambda when using #16253

@TomasChmelik

Description

@TomasChmelik

When I try to pass null as some parameter of a lambda, it gets removed from resulting task's parameters.

It might have same result for javascript lambdas, but in Python there is a difference between key not being in input event and key being there with value null (or None in Python's case).

This issue can be worked around by adding additional checks in the lambda, but that would add additional step needed for migration to CDK.

Reproduction Steps

from aws_cdk import aws_lambda
from aws_cdk import aws_stepfunctions
from aws_cdk import aws_stepfunctions_tasks


some_lambda = aws_lambda.Function.from_function_arn(scope, 'SomeLambda', 'arn:aws:lambda:eu-central-1:123456789:function:some-lambda')

aws_stepfunctions_tasks.LambdaInvoke(
    scope,
    'Lambda',
    lambda_function=some_lambda,
    payload=aws_stepfunctions.TaskInput.from_object({
        'nullParameter': None,
        'notNullParameter': 'not null'
    }),
    payload_response_only=True,
    retry_on_service_exceptions=False
)

What did you expect to happen?

{
    "Type": "Task",
    "Resource": "arn:aws:lambda:eu-central-1:123456789:function:some-lambda",
    "Parameters": {
        "nullParameter": null,
        "notNullParameter": "not null"
    }
}

What actually happened?

{
    "Type": "Task",
    "Resource": "arn:aws:lambda:eu-central-1:123456789:function:some-lambda",
    "Parameters": {
        "notNullParameter": "not null"
    }
}

Environment

  • CDK CLI Version :1.118.0
  • Framework Version:???
  • Node.js Version:v15.14.0
  • OS :Ubuntu 18.04.5 LTS
  • Language (Version):Python 3.7.4

Other


This is 🐛 Bug Report

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions