Skip to content

Commit 25317cf

Browse files
carderneTrigger.dev RepoOps
authored andcommitted
fix(webapp): reject unsupported deployment runtimes with a 400
Deployments with an unsupported `runtime` now fail with a 400 that names the supported runtimes, instead of a generic 500. Mono-RevId: 82fda1dd3e8d4d224323d828c99f06470e469cac
1 parent f8669e7 commit 25317cf

2 files changed

Lines changed: 18 additions & 1 deletion

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: fix
4+
---
5+
6+
Deployments with an unsupported `runtime` now fail with a 400 that names the supported runtimes, instead of a generic 500

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

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import {
2+
type BuildRuntime,
23
type BuildServerMetadata,
34
type InitializeDeploymentRequestBody,
45
type ExternalBuildData,
@@ -62,6 +63,16 @@ export class InitializeDeploymentService extends BaseService {
6263
options?: { cliVersion?: string }
6364
): Promise<InitializeDeploymentResult> {
6465
return this.traceWithEnv("call", environment, async (span) => {
66+
let runtime: BuildRuntime;
67+
try {
68+
runtime = resolveBuildRuntime(payload.runtime);
69+
} catch (error) {
70+
throw new ServiceValidationError(
71+
error instanceof Error ? error.message : String(error),
72+
400
73+
);
74+
}
75+
6576
if (payload.externalId) {
6677
span.setAttribute("externalId", payload.externalId);
6778
}
@@ -388,7 +399,7 @@ export class InitializeDeploymentService extends BaseService {
388399
git: payload.gitMeta ?? undefined,
389400
commitSHA: payload.gitMeta?.commitSha ?? undefined,
390401
externalId: payload.externalId,
391-
runtime: resolveBuildRuntime(payload.runtime),
402+
runtime,
392403
cliVersion: options?.cliVersion,
393404
triggeredVia: payload.triggeredVia ?? undefined,
394405
startedAt: initialStatus === "BUILDING" ? new Date() : undefined,

0 commit comments

Comments
 (0)