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
This commit is contained in:
nicktrn
2024-11-01 15:41:31 +00:00
committed by GitHub
parent 41f5261fe5
commit 58def055d0
5 changed files with 24 additions and 0 deletions
+5
View File
@@ -0,0 +1,5 @@
---
"@trigger.dev/core": patch
---
Add outdated SDK error
@@ -4,6 +4,7 @@ import {
ProdTaskRunExecution,
ProdTaskRunExecutionPayload,
TaskRunError,
TaskRunErrorCodes,
TaskRunExecution,
TaskRunExecutionLazyAttemptPayload,
TaskRunExecutionResult,
@@ -519,6 +520,11 @@ export class SharedQueueConsumer {
taskRun: lockedTaskRun.id,
});
const service = new CrashTaskRunService();
await service.call(lockedTaskRun.id, {
errorCode: TaskRunErrorCodes.OUTDATED_SDK_VERSION,
});
await this.#ackAndDoMoreWork(message.messageId);
return;
}
+9
View File
@@ -167,6 +167,7 @@ export function shouldRetryError(error: TaskRunError): boolean {
case "MAX_DURATION_EXCEEDED":
case "DISK_SPACE_EXCEEDED":
case "TASK_RUN_HEARTBEAT_TIMEOUT":
case "OUTDATED_SDK_VERSION":
return false;
case "GRACEFUL_EXIT_TIMEOUT":
@@ -428,6 +429,14 @@ const prettyInternalErrors: Partial<
magic: "CONTACT_FORM",
},
},
OUTDATED_SDK_VERSION: {
message:
"Your task is using an outdated version of the SDK. Please upgrade to the latest version.",
link: {
name: "Beta upgrade guide",
href: links.docs.upgrade.beta,
},
},
};
const getPrettyTaskRunError = (code: TaskRunInternalError["code"]): TaskRunInternalError => {
+3
View File
@@ -9,6 +9,9 @@ export const links = {
machines: {
home: "https://trigger.dev/docs/v3/machines",
},
upgrade: {
beta: "https://trigger.dev/docs/upgrading-beta",
},
},
site: {
home: "https://trigger.dev",
+1
View File
@@ -104,6 +104,7 @@ export const TaskRunInternalError = z.object({
"DISK_SPACE_EXCEEDED",
"POD_EVICTED",
"POD_UNKNOWN_ERROR",
"OUTDATED_SDK_VERSION",
]),
message: z.string().optional(),
stackTrace: z.string().optional(),