MCPcopy Index your code
hub / github.com/triggerdotdev/trigger.dev / runTask

Method runTask

packages/trigger-sdk/src/apiClient.ts:138–166  ·  view source on GitHub ↗
(
    runId: string,
    task: RunTaskBodyInput,
    options: { cachedTasksCursor?: string } = {}
  )

Source from the content-addressed store, hash-verified

136 }
137
138 async runTask(
139 runId: string,
140 task: RunTaskBodyInput,
141 options: { cachedTasksCursor?: string } = {}
142 ) {
143 const apiKey = await this.#apiKey();
144
145 this.#logger.debug(`[ApiClient] runTask ${task.displayKey}`);
146
147 return await zodfetchWithVersions(
148 this.#logger,
149 {
150 [API_VERSIONS.LAZY_LOADED_CACHED_TASKS]: RunTaskResponseWithCachedTasksBodySchema,
151 },
152 ServerTaskSchema,
153 `${this.#apiUrl}/api/v1/runs/${runId}/tasks`,
154 {
155 method: "POST",
156 headers: {
157 "Content-Type": "application/json",
158 Authorization: `Bearer ${apiKey}`,
159 "Idempotency-Key": task.idempotencyKey,
160 "X-Cached-Tasks-Cursor": options.cachedTasksCursor ?? "",
161 "Trigger-Version": API_VERSIONS.LAZY_LOADED_CACHED_TASKS,
162 },
163 body: JSON.stringify(task),
164 }
165 );
166 }
167
168 async completeTask(runId: string, id: string, task: CompleteTaskBodyV2Input) {
169 const apiKey = await this.#apiKey();

Callers

nothing calls this directly

Calls 3

#apiKeyMethod · 0.95
zodfetchWithVersionsFunction · 0.85
debugMethod · 0.65

Tested by

no test coverage detected