#Payload in SQL query in runs
1 messages · Page 1 of 1 (latest)
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:
- 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);
}
}
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.
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
Alright. I will make do with that for now.
Any plans for includinjg it in the schema in the future?
we have a feature request which can be upvoted here: https://triggerdev.featurebase.app/p/filter-runs-by-payload-value