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

Invalid type for parameter input (step_function.start_execution)

I have a start_execution command to start a step function via my lambda function (python):

    if event['Records'][0]['eventName'] == 'INSERT':
            filename, source, destination_bucket_name, filekey = parse_file_info_from_trigger(event)
            response = client.start_execution(
                stateMachineArn='aws:states:.......',
                input = "{\"first_name\" : \"test\"}"       
            )
    else: 
        logger.info(f'This is not an Insert event')

How can I pass the above extracted variables (filename, source etc) into the input of the start-execution command?

I tried this:

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

 response = step_function.start_execution(
                    stateMachineArn=state_machine_zip_files_arn,
                    input = str({ "filename": f"{filename}",  "filetype": f"{filetype}",  "unixtimestamp": f"{unixtimestamp}", 
                    "masterclient": f"{masterclient}", "source_bucket_name": f"{source_bucket_name}" , 
                    "destination_bucket_name": f"{destination_bucket_name}", "filekey": f"{filekey}","this is a test string": f"teststring"})     
                    )

but it gives me an error that:

Unable to start_execution for state machine: An error occurred (InvalidExecutionInput) when calling the StartExecution operation: Invalid State Machine Execution Input: 'Unexpected character (''' (code 39)): was expecting double-quote to start field name'

>Solution :

The expected format of input is a str. You should convert your dict into a str as following: json.dumps(your_input_data).

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