Created
April 17, 2024 09:15
-
-
Save mjzone/956055b006aec6acc59eef98a8eb2c5d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { SFNClient, StartSyncExecutionCommand } from "@aws-sdk/client-sfn"; | |
const region = process.env.AWS_REGION; | |
const stateMachineArn = process.env.STATE_MACHINE_ARN; | |
const client = new SFNClient({ region }); | |
export const handler = async (event) => { | |
const params = { | |
stateMachineArn, | |
input: JSON.stringify({ key: 'hello' }), | |
}; | |
const command = new StartSyncExecutionCommand(params); | |
try { | |
const data = await client.send(command); | |
console.log("Success", data); | |
return { | |
statusCode: 200, | |
body: JSON.stringify({ message: 'Success!', data }), | |
}; | |
} catch (err) { | |
console.error("Error", err); | |
return { | |
statusCode: 500, | |
body: JSON.stringify({ message: 'Error', error: err.message }), | |
}; | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
great sir