#Payload in SQL query in runs

1 messages · Page 1 of 1 (latest)

shadow flume
#

I am trying to fetch my failed runs and want to extract the payload for them. I don't see a column for that in the schema. Is that not allowed yet or am I missing anything?

torn pebbleBOT
#

Hi @shadow flume. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

Unfortunately, the payload column is not available in the TRQL (Trigger.dev Query Language) runs table. The knowledge sources describe the available columns for the runs table in queries, and payload is not among them. [Query docs]

The runs table in TRQL includes columns like run_id, status, task_identifier, triggered_at, compute_cost, usage_duration, tags, output, error, queue, machine, etc. — but not payload.

What you can do instead

If you need the payload for failed runs, you can use the Runs API to retrieve it programmatically:

  1. List failed runs using runs.list() with a status filter:
import { runs } from "@trigger.dev/sdk";

for await (const run of runs.list({ status: ["FAILED"] })) {
  const fullRun = await runs.retrieve(run.id);
  console.log("Run ID:", fullRun.id);
  console.log("Payload:", fullRun.payload);

  // If the payload is large (>512KB), use the presigned URL:
  if (fullRun.payloadPresignedUrl) {
    const response = await fetch(fullRun.payloadPresignedUrl);
    const payload = await response.json();
    console.log("Payload (from URL):", payload);
  }
}

[Runs API; Large Payloads]

Note that payload is omitted from runs.retrieve() responses if you authenticate with a Public API key — you'll need a Secret API key to access it. [Retrieve run]

So to summarize: payload querying via TRQL SQL is not currently supported — you'll need to use the SDK's runs.retrieve() for that.

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:

#

@shadow flume Kapa.ai is still learning and improving, please let me know how I did by reacting below.

drifting lantern
#

hey, the runs schema doesn’t expose a payload column yet in Query. you can use the runs.list + runs.retrieve function if you want to get payloads for failed runs

shadow flume
#

Alright. I will make do with that for now.

Any plans for includinjg it in the schema in the future?

drifting lantern