getWorkflowMetadata

Access run IDs and timing information within workflow or step functions.

Returns metadata about the current workflow run. This function can be called from either a workflow function or a step function.

You may want to use this function when you need to:

  • Log workflow run IDs
  • Access timing information of a workflow
  • Retrieve the workflow URL from within a step

If you need to access step-specific context, take a look at getStepMetadata.

import { getWorkflowMetadata } from "workflow"

async function testWorkflow() {
    "use workflow"

    const ctx = getWorkflowMetadata() 
    console.log(ctx.workflowRunId)
}

API Signature

Parameters

This function does not accept any parameters.

Returns

Returns a WorkflowMetadata object with the following fields:

FieldTypeDescription
workflowNamestringThe name of the workflow.
workflowRunIdstringUnique identifier for the workflow run.
workflowStartedAtDateTimestamp when the workflow run started.
urlstringThe URL where the workflow can be triggered.
NameTypeDescription
workflowNamestringThe name of the workflow.
workflowRunIdstringUnique identifier for the workflow run.
workflowStartedAtDateTimestamp when the workflow run started.
urlstringThe URL where the workflow can be triggered.

On this page

GitHubEdit this page on GitHub