diff --git a/packages/backend/src/service.ts b/packages/backend/src/service.ts index c0f69ad0..0a09c27e 100644 --- a/packages/backend/src/service.ts +++ b/packages/backend/src/service.ts @@ -253,14 +253,14 @@ export class Service { } await this.db.deleteDeploymentById(oldDNSDeployment.id); + } - // Update domain after the previous DNS deployment is deleted due to unique key constraint for domain - // Set the domain for the new current DNS deployment to the custom domain that was added for that project - const domain = await this.db.getOldestDomainByProjectId(deployment.project.id); + // Update domain after the previous DNS deployment is deleted due to unique key constraint for domain + // Set the domain for the new current DNS deployment to the custom domain that was added for that project + const customDomain = await this.db.getOldestDomainByProjectId(deployment.project.id); - if (domain) { - await this.db.updateDeploymentById(deployment.id, { domain }); - } + if (customDomain) { + await this.db.updateDeploymentById(deployment.id, { domain: customDomain }); } }