Skip to content

InvokeLambdaFunctionStep user input is overwritten by default outputs during doc ouptput validation. #93

@wmattei

Description

@wmattei

If I have a lambda invocation step that looks like this:

new InvokeLambdaFunctionStep(this, "soft-delete-step", {
    name: "InvokeMyLambda",
    functionName: HardCodedString.of("my-lambda"),
    payload: new HardCodedStringMap({}),
    userOutputs: [
        {
            name: "Message",
            outputType: DataTypeEnum.STRING,
            selector: "$.message",
        },
    ],
});

And then in my doc I have docOuputs that looks like this:

docOutputs: [
    {
        name: "InvokeMyLambda.Message",
        outputType: DataTypeEnum.STRING,
    },
],

During synth I will get this error:

Error: Resolution error: Resolution error: Resolution error: Cannot find output {"name":"InvokeMyLambda.Message","outputType":0} specified as an output of step InvokeMyLambda.

The reason this happens, is because during doc output validation, we look for step outputs to see if they match the name that we reference in the doc outputs. See https://github.com/cdklabs/cdk-ssm-documents/blob/main/src/document/automation-document.ts#L88-L89

However, the InvokeLambdaFunctionStep overrides the listOutputs method returning a static list of outputs. See https://github.com/cdklabs/cdk-ssm-documents/blob/main/src/parent-steps/automation/invoke-lambda-function-step.ts#L70

Therefore, user outputs can never be used as document outputs.

I would be happy to work on this issue, just need to know if there is any reason why this happens, or if it is simply a bug.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions