Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

Stop adding each staging domain to Vercel

Rafic3f30d5872e1
diff --git a/apps/web/lib/sandbox/create-staging-workspace.ts b/apps/web/lib/sandbox/create-staging-workspace.ts
index 551f1b215c..0df5656941 100644
--- a/apps/web/lib/sandbox/create-staging-workspace.ts
+++ b/apps/web/lib/sandbox/create-staging-workspace.ts
@@ -1,5 +1,4 @@
import { createId } from "@/lib/api/create-id";
-import { addDomainToVercel } from "@/lib/api/domains/add-domain-vercel";
import { createLink } from "@/lib/api/links";
import { getPlanCapabilities } from "@/lib/plan-capabilities";
import { prisma } from "@/lib/prisma";
@@ -162,21 +161,10 @@ export async function createStagingWorkspace(workspaceId: string) {
);
}
+ // The `*.staging.dub.link` wildcard on the Vercel project serves this host,
+ // so the domain only needs a database row.
const domain = `${workspace.slug}${STAGING_DUB_DOMAIN_SUFFIX}`;
- if (process.env.VERCEL === "1") {
- const vercelResponse = await addDomainToVercel(domain);
-
- if (
- vercelResponse.error &&
- vercelResponse.error.code !== "domain_already_in_use"
- ) {
- throw new Error(
- `Failed to add staging domain ${domain} to Vercel: ${JSON.stringify(vercelResponse.error)}`,
- );
- }
- }
-
const existingDomain = await prisma.domain.findUnique({
where: {
slug: domain,