Skip to content

Commit 6edebde

Browse files
committed
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.
1 parent 6e6deb4 commit 6edebde

3 files changed

Lines changed: 34 additions & 0 deletions

File tree

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
area: webapp
3+
type: breaking
4+
---
5+
6+
Add server-side deprecation gate for deploys from v3 CLI versions (gated by `DEPRECATE_V3_CLI_DEPLOYS_ENABLED`). v4 CLI deploys are unaffected.

apps/webapp/app/env.server.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,12 @@ const EnvironmentSchema = z
348348
.int()
349349
.default(60 * 1000 * 15), // 15 minutes
350350

351+
// When enabled, reject deploys made by v3 CLI versions (i.e. payloads that
352+
// omit the `type` field). v4 CLI versions always send `type` ("MANAGED" or "V1"),
353+
// so they are unaffected. Defaults to off so detection can run in
354+
// log-only mode before enforcement.
355+
DEPRECATE_V3_CLI_DEPLOYS_ENABLED: z.string().default("0"),
356+
351357
OBJECT_STORE_BASE_URL: z.string().optional(),
352358
OBJECT_STORE_BUCKET: z.string().optional(),
353359
OBJECT_STORE_ACCESS_KEY_ID: z.string().optional(),

apps/webapp/app/v3/services/initializeDeployment.server.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,28 @@ export class InitializeDeploymentService extends BaseService {
5959
};
6060
}
6161

62+
// v4 CLI versions always send `payload.type` ("MANAGED" or "V1"). v3 CLI
63+
// versions never do, so the absence of `type` is a reliable signal that
64+
// the request came from a 3.x CLI. Detection always runs (so we can
65+
// observe how many deploys are still using v3), enforcement is gated
66+
// behind DEPRECATE_V3_CLI_DEPLOYS_ENABLED so it can be rolled out safely.
67+
if (!payload.type) {
68+
const enforced = env.DEPRECATE_V3_CLI_DEPLOYS_ENABLED === "1";
69+
70+
logger.warn("Detected deploy from deprecated v3 CLI", {
71+
environmentId: environment.id,
72+
projectId: environment.projectId,
73+
organizationId: environment.project.organizationId,
74+
enforced,
75+
});
76+
77+
if (enforced) {
78+
throw new ServiceValidationError(
79+
"The trigger.dev CLI v3 is no longer supported for deployments. Please upgrade your project to v4: https://trigger.dev/docs/migrating-from-v3"
80+
);
81+
}
82+
}
83+
6284
if (payload.type === "UNMANAGED") {
6385
throw new ServiceValidationError("UNMANAGED deployments are not supported");
6486
}

0 commit comments

Comments
 (0)