Search code examples
python-3.xamazon-web-servicesaws-step-functions

How to Pass step function result to eventbridge put event


Using step functions put event i would like to pass the data sent to my step to event bridge and then pass the same exact input to the next step.

        ingest_sfn["flatten_metadata"] = sfn.Pass(
        self,
        f"Flatten Metadata",
        input_path="$.metadata.result",
        result_path="$.metadata",
    )

    ingest_sfn["put_event"] = sfn_tasks.EventBridgePutEvents(self, "Put Event",
        entries=[sfn_tasks.EventBridgePutEventsEntry(
            detail=sfn.TaskInput.from_object({

            }),
            event_bus=event_bus_base,
            detail_type="MessageFromStepFunctions",
            source="step.function"
        )],
   
        result_path="$",
        output_path="$"
    )

the result of result_path="$.metadata" should be my input and output on the put event step.


Solution

  • Answer is to use

    result_path=sfn.JsonPath.DISCARD
    

    this will pass the input on to the next step as it had come into your step.