From 6edebde22b924a4bb6a88a78707a3c313f4c31a3 Mon Sep 17 00:00:00 2001 From: Eric Allam Date: Mon, 20 Apr 2026 13:18:57 +0000 Subject: [PATCH] feat(webapp): deprecate v3 CLI deploys server-side Detect deploys coming from v3 CLI versions (payloads that omit the 'type' field) and, when DEPRECATE_V3_CLI_DEPLOYS_ENABLED=1, reject them with a clear error that points to the migration docs. Enforcement is gated so we can observe v3 deploy traffic via logs before flipping. v4 CLIs always send 'type' ('MANAGED' or 'V1') on /api/v1/deployments, so they are unaffected. Verified against the CLI source for 4.0.0, 4.0.1, 4.0.5, 4.1.0, 4.2.0, and 4.4.4. --- .server-changes/deprecate-v3-cli-deploys.md | 6 +++++ apps/webapp/app/env.server.ts | 6 +++++ .../services/initializeDeployment.server.ts | 22 +++++++++++++++++++ 3 files changed, 34 insertions(+) create mode 100644 .server-changes/deprecate-v3-cli-deploys.md diff --git a/.server-changes/deprecate-v3-cli-deploys.md b/.server-changes/deprecate-v3-cli-deploys.md new file mode 100644 index 00000000000..72040b4c5ed --- /dev/null +++ b/.server-changes/deprecate-v3-cli-deploys.md @@ -0,0 +1,6 @@ +--- +area: webapp +type: breaking +--- + +Add server-side deprecation gate for deploys from v3 CLI versions (gated by `DEPRECATE_V3_CLI_DEPLOYS_ENABLED`). v4 CLI deploys are unaffected. diff --git a/apps/webapp/app/env.server.ts b/apps/webapp/app/env.server.ts index 8d72b2e51b2..b839af6eb5d 100644 --- a/apps/webapp/app/env.server.ts +++ b/apps/webapp/app/env.server.ts @@ -348,6 +348,12 @@ const EnvironmentSchema = z .int() .default(60 * 1000 * 15), // 15 minutes + // When enabled, reject deploys made by v3 CLI versions (i.e. payloads that + // omit the `type` field). v4 CLI versions always send `type` ("MANAGED" or "V1"), + // so they are unaffected. Defaults to off so detection can run in + // log-only mode before enforcement. + DEPRECATE_V3_CLI_DEPLOYS_ENABLED: z.string().default("0"), + OBJECT_STORE_BASE_URL: z.string().optional(), OBJECT_STORE_BUCKET: z.string().optional(), OBJECT_STORE_ACCESS_KEY_ID: z.string().optional(), diff --git a/apps/webapp/app/v3/services/initializeDeployment.server.ts b/apps/webapp/app/v3/services/initializeDeployment.server.ts index 987925aa709..9ecc25f9941 100644 --- a/apps/webapp/app/v3/services/initializeDeployment.server.ts +++ b/apps/webapp/app/v3/services/initializeDeployment.server.ts @@ -59,6 +59,28 @@ export class InitializeDeploymentService extends BaseService { }; } + // v4 CLI versions always send `payload.type` ("MANAGED" or "V1"). v3 CLI + // versions never do, so the absence of `type` is a reliable signal that + // the request came from a 3.x CLI. Detection always runs (so we can + // observe how many deploys are still using v3), enforcement is gated + // behind DEPRECATE_V3_CLI_DEPLOYS_ENABLED so it can be rolled out safely. + if (!payload.type) { + const enforced = env.DEPRECATE_V3_CLI_DEPLOYS_ENABLED === "1"; + + logger.warn("Detected deploy from deprecated v3 CLI", { + environmentId: environment.id, + projectId: environment.projectId, + organizationId: environment.project.organizationId, + enforced, + }); + + if (enforced) { + throw new ServiceValidationError( + "The trigger.dev CLI v3 is no longer supported for deployments. Please upgrade your project to v4: https://trigger.dev/docs/migrating-from-v3" + ); + } + } + if (payload.type === "UNMANAGED") { throw new ServiceValidationError("UNMANAGED deployments are not supported"); }