createFailpathClient(), the run() method, the step() method, and recordStep(). Use this as a quick lookup when you need to know a type, default value, or the exact behaviour of a particular option.
createFailpathClient() options
Pass these options to createFailpathClient() when you initialise the SDK client.
Your Failpath project key. Identifies which project receives the telemetry events your application sends. Always read this from an environment variable rather than hardcoding it.
A plain object merged into the metadata of every event the client sends — runs, steps, and skips alike. Use it for properties that apply globally, such as environment name or service identifier.Default:
undefinedOverrides the URL the SDK sends events to. This option is intended for local Failpath API development only. Do not set it in production.
Controls whether the SDK sends any events. Set to
false to silently disable all telemetry. Wrapped functions still execute and return values normally; only the send calls are skipped. Useful in test and CI environments.When
true, the SDK attaches the stack trace of any caught error to the outbound error event. Keep this disabled (the default) if your errors might contain sensitive data or if stack traces are prohibitively large.When
true, the SDK throws if a telemetry send request fails. The default (false) means telemetry failures are swallowed and do not affect your application. Only enable this when strict delivery guarantees are required.A callback invoked whenever a telemetry send request fails. Use this alongside
throwOnSendError: false to route SDK errors into your logging or alerting infrastructure without disrupting your application.Default: undefinedA custom
fetch implementation. Supply this when your runtime lacks a native fetch global — for example, Node.js versions before 18 — or when you need to proxy outbound requests. The signature must match the standard fetch API.Default: globalThis.fetchfailpath.run() options
Pass these options as the second argument to failpath.run(flowKey, options).
A unique identifier that correlates every step belonging to the same request, job, or webhook invocation. Failpath uses this value to group steps into a single trace in the dashboard. Reuse the same
runId for every step() call within one execution.Default: auto-generatedGood sources for a runId: an HTTP request ID header, a job ID from your queue, or a webhook delivery ID from the upstream service.Arbitrary key/value pairs attached to this run. Merged with
defaultMetadata from the client. Use this for data that applies to the whole execution but not to every event globally — for example, the request route or the authenticated user ID.Default: undefinedrun.step() options
Pass these options as the third argument to run.step(stepKey, fn, options).
Arbitrary key/value pairs attached to this specific step event. Use this for data relevant only to this operation — for example, the ID of the entity being processed.Default:
undefinedfailpath.recordStep() parameters
Pass these as a single options object to failpath.recordStep(options). All four parameters are required.
The slug of the flow this step belongs to. Must match the
flow.slug value in .failpath/flows.json.The run ID that groups this step with others in the same execution. Use the same value you used when calling
failpath.run() for this execution.The key identifying this step within the flow. Must match the
sdkStepKey of the corresponding node in .failpath/flows.json.The status to record for this step event. Send
running when the operation begins and then success or error when it completes, or send a terminal status directly if you are recording after the fact.