Skip to content

Commit 756973f

Browse files
committed
fix v3 deploys in v4 project
1 parent 3ca58dc commit 756973f

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

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

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,20 @@ export class InitializeDeploymentService extends BaseService {
1818
payload: InitializeDeploymentRequestBody
1919
) {
2020
return this.traceWithEnv("call", environment, async (span) => {
21-
if (payload.type !== "V1" && environment.project.engine !== "V2") {
22-
throw new ServiceValidationError("Only V1 deployments are supported for this project");
21+
if (payload.type === "UNMANAGED") {
22+
throw new ServiceValidationError("UNMANAGED deployments are not supported");
23+
}
24+
25+
// Upgrade the project to engine "V2" if it's not already. This should cover cases where people deploy to V2 without running dev first.
26+
if (payload.type === "MANAGED" && environment.project.engine === "V1") {
27+
await this._prisma.project.update({
28+
where: {
29+
id: environment.project.id,
30+
},
31+
data: {
32+
engine: "V2",
33+
},
34+
});
2335
}
2436

2537
const latestDeployment = await this._prisma.workerDeployment.findFirst({

0 commit comments

Comments
 (0)