cdklabs / cdklabs/cdk-ssm-documents
InvokeLambdaFunctionStep user input is overwritten by default outputs during doc ouptput validation.
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 30
- Forks
- 9
- Avg merge
- 1d 16m
- Merged PRs (30d)
- 7
Description
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the doc output validation in src/document/automation-document.ts around lines 88-89, then inspect listOutputs in src/parent-steps/automation/invoke-lambda-function-step.ts around line 70. Reproduce the supplied InvokeLambdaFunctionStep configuration during synth and verify that the user-defined Message output is accepted as a document output without the resolution error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, typescript
- Domain
- cloud
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100