diff --git a/.changeset/giant-mugs-clean.md b/.changeset/giant-mugs-clean.md new file mode 100644 index 0000000000..95eca67ae7 --- /dev/null +++ b/.changeset/giant-mugs-clean.md @@ -0,0 +1,5 @@ +--- +"@trigger.dev/core": patch +--- + +Add outdated SDK error diff --git a/apps/webapp/app/v3/marqs/sharedQueueConsumer.server.ts b/apps/webapp/app/v3/marqs/sharedQueueConsumer.server.ts index eed8d7f5ae..96273869e4 100644 --- a/apps/webapp/app/v3/marqs/sharedQueueConsumer.server.ts +++ b/apps/webapp/app/v3/marqs/sharedQueueConsumer.server.ts @@ -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; } diff --git a/packages/core/src/v3/errors.ts b/packages/core/src/v3/errors.ts index bd2238043f..232bb8aa94 100644 --- a/packages/core/src/v3/errors.ts +++ b/packages/core/src/v3/errors.ts @@ -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 => { diff --git a/packages/core/src/v3/links.ts b/packages/core/src/v3/links.ts index 5f4f27210d..39b5a89589 100644 --- a/packages/core/src/v3/links.ts +++ b/packages/core/src/v3/links.ts @@ -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", diff --git a/packages/core/src/v3/schemas/common.ts b/packages/core/src/v3/schemas/common.ts index 1e39a04ff1..325228d8c1 100644 --- a/packages/core/src/v3/schemas/common.ts +++ b/packages/core/src/v3/schemas/common.ts @@ -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(),