Skip to content

Add and use new internal error for very outdated SDK versions #1453

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/giant-mugs-clean.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@trigger.dev/core": patch
---

Add outdated SDK error
6 changes: 6 additions & 0 deletions apps/webapp/app/v3/marqs/sharedQueueConsumer.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
ProdTaskRunExecution,
ProdTaskRunExecutionPayload,
TaskRunError,
TaskRunErrorCodes,
TaskRunExecution,
TaskRunExecutionLazyAttemptPayload,
TaskRunExecutionResult,
Expand Down Expand Up @@ -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;
}
Expand Down
9 changes: 9 additions & 0 deletions packages/core/src/v3/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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":
Expand Down Expand Up @@ -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 => {
Expand Down
3 changes: 3 additions & 0 deletions packages/core/src/v3/links.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/v3/schemas/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
Loading