Sanity Library Reference Docs
    Preparing search index...

    Function defineDurableFunction

    • Beta

      Defines a durable function resource.

      Parameters

      • functionConfig: BlueprintDurableConfig

        The configuration for the function

        Configuration for defining a durable function.

        Deploying Durable Functions via Blueprints is experimental.

        • Optional BetadisplayName?: string

          Human-readable display name for the function

        • Optional BetadurableTimeout?: string | number

          Total durable execution timeout in seconds.

          86_400 (24 hours)
          
        • Optional Betaenv?: Record<string, string>

          Environment variables provided to the function

        • Optional Betaevent?: BlueprintFunctionResourceContentLakeEvent

          Trigger configuration

        • Optional Betamemory?: number

          Memory allocation in gigabytes

        • Betaname: string

          The name of the resource. Unique within the blueprint. e.g. 'sync-webhook'

        • Optional Betaproject?: string

          The project ID of the project that contains your function.

          The project attribute must be defined if your blueprint is scoped to an organization.

        • Optional BetarobotToken?: string

          Token provided during function invocation

        • Optional Betaruntime?: "node" | "nodejs22.x" | "nodejs24.x"

          The runtime environment for the function (currently only Node.js is supported)

          'nodejs24.x'
          
        • Optional Betasrc?: string

          Path to the function source code

          functions/${name}

        • Optional Betatimeout?: number

          Execution timeout in seconds

      Returns BlueprintDurableFunctionResource

      The validated durable function resource

      defineDurableFunction({
      name: 'daily-cleanup',
      event: {type: 'document', on: ['create'], filter: "_type == 'post'"},
      })