Skip to content

fetchExecutionHistory

function fetchExecutionHistory(params): Promise<HistoryEvent[]>;

Defined in: src/aws.ts:45

Fetches the complete history of a Step Functions execution, paginating through every GetExecutionHistory page so callers don’t have to hand-roll the nextToken loop.

The returned HistoryEvent[] can be passed straight to parseExecutionHistory, generateExecution, or generateMermaidExecution from sfn-diagram.

FetchExecutionHistoryParams

The SFN client, execution ARN, and optional page size.

Promise<HistoryEvent[]>

All history events for the execution, in chronological order.

import { SFNClient } from '@aws-sdk/client-sfn';
import { fetchExecutionHistory } from 'sfn-diagram/aws';
import { generateExecution } from 'sfn-diagram';
const client = new SFNClient({ region: 'us-east-1' });
const events = await fetchExecutionHistory({ client, executionArn });
const { svg } = generateExecution({ aslDefinition: asl, history: events });