Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

AWS CDK – Can I Pass LambdaInvoke's InputPath Prop Multiple JSON Paths?

I find new LambdaInvoke requires the inputPath to be a string, so whether I need to pass the event an object from multiple places, I need a Pass state to make it happen.

    this.organiseTheArrayAndId = new Pass(this, "Organise the Array and Id Together In One Object", {
      parameters: {
        "array": JsonPath.stringAt("$.productIdsArray"),
        "value": JsonPath.numberAt("$.productId.id")
      },
      resultPath: "$.organiseTheArrayAndId",
    });

    this.augmentProductIdArray = new LambdaInvoke(this, "Add the Product ID To The Array", {
      lambdaFunction: lambdaFunctionLocation,
      inputPath: "$.organiseTheArrayAndId",
    });

Is there a more efficient way?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

The LambdaInvoke task construct’s payload property lets you customize the input your function receives when invoked:

payload: sfn.TaskInput.fromObject({
    array: JsonPath.stringAt("$.productIdsArray"),
    value: JsonPath.numberAt("$.productId.id")
}),
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading