- Events
- Types of events
ExecutionStartedeventExecutionSucceededeventExecutionFailedeventExecutionAbortedeventExecutionTimeouteventMapIterationStartedeventMapIterationSucceededeventMapIterationFailedeventParallelBranchStartedeventParallelBranchSucceededeventParallelBranchFailedeventStateEnteredeventStateExitedeventStateFailedeventStateRetriedeventStateCaughtevent
- Helper data types
Execution events are represented as plain objects, and all of them share two common fields:
type: A string that indicates the type of the event being produced.timestamp: The Unix timestamp in milliseconds, representing the time at which the event was produced.
In turn, each type of event may contain additional fields containing supplementary data associated with the event.
The ExecutionStarted event is produced when the execution is started.
input: Input value passed to the execution.
{
type: 'ExecutionStarted',
timestamp: 1234567890123,
input: { id: 5, coordX: '12.638614', coordY: '-36.581396' }
}The ExecutionSucceeded event is produced when the execution ends successfully.
output: Output value produced by the execution.
{
type: 'ExecutionSucceeded',
timestamp: 1234567890123,
output: [55, 99, 22]
}The ExecutionFailed event is produced when the execution encounters an error and fails.
Error: Name of the error that caused the failure.Cause: This field can either be a string or an object:string: Contains a description explaining why the execution failed.object: Contains details that provide more information as to why the execution failed.
{
type: 'ExecutionFailed',
timestamp: 1234567890123,
Error: 'TypeError',
Cause: "Cannot read properties of undefined (reading '0')"
}The ExecutionAborted event is produced when the execution is aborted by calling the abort function returned by the StateMachine.run method.
None.
{
type: 'ExecutionAborted',
timestamp: 1234567890123
}The ExecutionTimeout event is produced when the execution times out because the execution ran longer than the number of seconds specified in the TimeoutSeconds top-level field.
None.
{
type: 'ExecutionTimeout',
timestamp: 1234567890123
}The MapIterationStarted event is produced when an iteration in a Map state has started.
parentState: An object of typeStateDatacontaining data associated with theMapstate to which this iteration belongs to.index: The index of this iteration.input: Input value passed to the iteration.
{
type: 'MapIterationStarted',
timestamp: 1234567890123,
parentState: {
name: 'MapState',
type: 'Map',
input: [
{ prod: "R31", dest-code: 9511, quantity: 1344 },
{ prod: "S39", dest-code: 9511, quantity: 40 }
]
},
index: 0,
input: { prod: "R31", dest-code: 9511, quantity: 1344 }
}The MapIterationSucceeded event is produced when an iteration in a Map state ends successfully.
parentState: An object of typeStateDatacontaining data associated with theMapstate to which this iteration belongs to.index: The index of this iteration.output: Output value produced by the iteration.
{
type: 'MapIterationSucceeded',
timestamp: 1234567890123,
parentState: {
name: 'MapState',
type: 'Map',
input: [
{ prod: "R31", dest-code: 9511, quantity: 1344 },
{ prod: "S39", dest-code: 9511, quantity: 40 }
]
},
index: 0,
output: true
}The MapIterationFailed event is produced when an iteration in a Map encounters an error and fails.
parentState: An object of typeStateDatacontaining data associated with theMapstate to which this iteration belongs to.index: The index of this iteration.Error: Name of the error that caused the failure.Cause: This field can either be a string or an object:string: Contains a description explaining why the iteration failed.object: Contains details that provide more information as to why the iteration failed.
{
type: 'MapIterationFailed',
timestamp: 1234567890123,
parentState: {
name: 'MapState',
type: 'Map',
input: [
{ prod: "R31", dest-code: 9511, quantity: 1344 },
{ prod: "S39", dest-code: 9511, quantity: 40 }
]
},
index: 0,
Error: 'CustomProcessingError',
Cause: 'Could not process item with id `R31` sucessfully'
}The ParallelBranchStarted event is produced when a branch in a Parallel state has started.
parentState: An object of typeStateDatacontaining data associated with theParallelstate to which this branch belongs to.input: Input value passed to the branch.
{
type: 'ParallelBranchStarted',
timestamp: 1234567890123,
parentState: {
name: 'ParallelState',
type: 'Parallel',
input: { bucketName: 'videos-bucket', key: 'training/first-day.mp4' }
},
input: { bucketName: 'videos-bucket', key: 'training/first-day.mp4' }
}The ParallelBranchSucceeded event is produced when a branch in a Parallel state ends successfully.
parentState: An object of typeStateDatacontaining data associated with theParallelstate to which this branch belongs to.output: Output value produced by the branch.
{
type: 'ParallelBranchSucceeded',
timestamp: 1234567890123,
parentState: {
name: 'ParallelState',
type: 'Parallel',
input: { bucketName: 'videos-bucket', key: 'training/first-day.mp4' }
},
output: { compressedSize: 12364311 }
}The ParallelBranchFailed event is produced when a branch in a Parallel state encounters an error and fails.
parentState: An object of typeStateDatacontaining data associated with theParallelstate to which this branch belongs to.Error: Name of the error that caused the failure.Cause: This field can either be a string or an object:string: Contains a description explaining why the branch failed.object: Contains details that provide more information as to why the branch failed.
{
type: 'ParallelBranchFailed',
timestamp: 1234567890123,
parentState: {
name: 'ParallelState',
type: 'Parallel',
input: { bucketName: 'videos-bucket', key: 'training/first-day.mp4' }
},
Error: 'CompressionError',
Cause: 'Could not apply compression to item stored in bucket'
}The StateEntered event is produced when the execution transitions into a new state.
state: An object of typeStateDatacontaining data associated with the state that was entered.index?: The index of theMapiteration in which this state is being executed. This property is only set if this state is being executed within aMapstate.
{
type: 'StateEntered',
timestamp: 1234567890123,
state: {
name: 'AddNumbers',
type: 'Task',
input: { num1: 3, num2: 2 }
}
}The StateExited event is produced when the execution transitions out of a state.
state: An object of typeStateDatacontaining data associated with the state that was exited.index?: The index of theMapiteration in which this state was executed. This property is only set if this state was executed within aMapstate.
{
type: 'StateExited',
timestamp: 1234567890123,
state: {
name: 'AddNumbers',
type: 'Task',
input: { num1: 3, num2: 2 },
output: 5
}
}The StateFailed event is produced when the state that is currently being executed encounters an error and fails.
state: An object of typeStateDatacontaining data associated with the state that failed.Error: Name of the error that caused the state to fail.Cause: This field can either be a string or an object:string: Contains a description explaining why the state failed.object: Contains details that provide more information as to why the state failed.
index?: The index of theMapiteration in which this state failed. This property is only set if this state was executed within aMapstate.
{
type: 'StateFailed',
timestamp: 1234567890123,
state: {
name: 'ReadDataFile',
type: 'Task',
input: { filePath: '/home/user/data.csv' }
},
Error: 'ReadError',
Cause: 'Unable to read file "data.csv". The file is not properly formatted as CSV.'
}The StateRetried event is produced when a state fails and it's retried because it matched the error specified by a retrier in the Retry field.
state: An object of typeStateDatacontaining data associated with the state that is being retried.retry: An object of typeRetryDatacontaining data associated with the retry attempt.index?: The index of theMapiteration in which this state is being retried. This property is only set if this state is being executed within aMapstate.
{
type: 'StateRetried',
timestamp: 1234567890123,
state: {
name: 'ReadDataFile',
type: 'Task',
input: { filePath: '/home/user/data.csv' }
},
retry: {
retrier: { ErrorEquals: ['ReadError'] },
attempt: 2
}
}The StateCaught event is produced when a state fails and it's caught because it matched the error specified by a catcher in the Catch field.
state: An object of typeStateDatacontaining data associated with the state that was caught.catch: An object of typeCatchDatacontaining data associated with the caught error.index?: The index of theMapiteration in which this state was caught. This property is only set if this state was executed within aMapstate.
{
type: 'StateCaught',
timestamp: 1234567890123,
state: {
name: 'ReadDataFile',
type: 'Task',
input: { filePath: '/home/user/data.csv' }
},
catch: {
catcher: {
ErrorEquals: ['ReadError'],
Next: 'RecoveryState'
}
}
}interface StateData {
name: string;
type: 'Task' | 'Parallel' | 'Map' | 'Pass' | 'Wait' | 'Choice' | 'Succeed' | 'Fail';
input: any;
output?: any;
}name: Name of the state.type: Type of the state.input: The input passed to the state.output: The output produced by the state. Only set when event is of typeStateExited.
interface RetryData {
retrier: {
ErrorEquals: string[];
IntervalSeconds?: number;
MaxAttempts?: number;
BackoffRate?: number;
MaxDelaySeconds?: number;
JitterStrategy?: 'NONE' | 'FULL';
};
attempt: number;
}retrier: The retrier object that caused the state to be retried.attempt: Number of current attempt (attempt: 1being the first attempt).
interface CatchData {
catcher: {
ErrorEquals: string[];
Next: string;
ResultPath?: string;
};
}catcher: The catcher object that caused the state to be caught.