Skip to content

Commit 58def05

Browse files
authored
Add new internal error for very outdated SDK versions (#1453)
* add outdated sdk error and crash outdated runs instead of staying queued forever * add changeset
1 parent 41f5261 commit 58def05

File tree

5 files changed

+24
-0
lines changed

5 files changed

+24
-0
lines changed

.changeset/giant-mugs-clean.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@trigger.dev/core": patch
3+
---
4+
5+
Add outdated SDK error

apps/webapp/app/v3/marqs/sharedQueueConsumer.server.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {
44
ProdTaskRunExecution,
55
ProdTaskRunExecutionPayload,
66
TaskRunError,
7+
TaskRunErrorCodes,
78
TaskRunExecution,
89
TaskRunExecutionLazyAttemptPayload,
910
TaskRunExecutionResult,
@@ -519,6 +520,11 @@ export class SharedQueueConsumer {
519520
taskRun: lockedTaskRun.id,
520521
});
521522

523+
const service = new CrashTaskRunService();
524+
await service.call(lockedTaskRun.id, {
525+
errorCode: TaskRunErrorCodes.OUTDATED_SDK_VERSION,
526+
});
527+
522528
await this.#ackAndDoMoreWork(message.messageId);
523529
return;
524530
}

packages/core/src/v3/errors.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ export function shouldRetryError(error: TaskRunError): boolean {
167167
case "MAX_DURATION_EXCEEDED":
168168
case "DISK_SPACE_EXCEEDED":
169169
case "TASK_RUN_HEARTBEAT_TIMEOUT":
170+
case "OUTDATED_SDK_VERSION":
170171
return false;
171172

172173
case "GRACEFUL_EXIT_TIMEOUT":
@@ -428,6 +429,14 @@ const prettyInternalErrors: Partial<
428429
magic: "CONTACT_FORM",
429430
},
430431
},
432+
OUTDATED_SDK_VERSION: {
433+
message:
434+
"Your task is using an outdated version of the SDK. Please upgrade to the latest version.",
435+
link: {
436+
name: "Beta upgrade guide",
437+
href: links.docs.upgrade.beta,
438+
},
439+
},
431440
};
432441

433442
const getPrettyTaskRunError = (code: TaskRunInternalError["code"]): TaskRunInternalError => {

packages/core/src/v3/links.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ export const links = {
99
machines: {
1010
home: "https://trigger.dev/docs/v3/machines",
1111
},
12+
upgrade: {
13+
beta: "https://trigger.dev/docs/upgrading-beta",
14+
},
1215
},
1316
site: {
1417
home: "https://trigger.dev",

packages/core/src/v3/schemas/common.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ export const TaskRunInternalError = z.object({
104104
"DISK_SPACE_EXCEEDED",
105105
"POD_EVICTED",
106106
"POD_UNKNOWN_ERROR",
107+
"OUTDATED_SDK_VERSION",
107108
]),
108109
message: z.string().optional(),
109110
stackTrace: z.string().optional(),

0 commit comments

Comments
 (0)