The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
Update route.ts
Steven Tey6100600e3206
diff --git a/apps/web/app/api/domains/route.ts b/apps/web/app/api/domains/route.tsindex 53915a53e2..0270f3cb37 100644--- a/apps/web/app/api/domains/route.ts+++ b/apps/web/app/api/domains/route.ts@@ -51,7 +51,10 @@ export const POST = withAuth(async ({ req, workspace }) => {}const vercelResponse = await addDomainToVercel(domain);- if (vercelResponse.error) {+ if (+ vercelResponse.error &&+ vercelResponse.error.code !== "domain_already_in_use" // ignore this error+ ) {return new Response(vercelResponse.error.message, { status: 422 });}/*@@ -60,20 +63,18 @@ export const POST = withAuth(async ({ req, workspace }) => {2. If there's a landing page set, update the root domain in Redis3. If the workspace has no domains (meaning this is the first domain added), set it as primary*/- const response = await Promise.all([- prisma.domain.create({- data: {- slug: domain,- target,- type,- projectId: workspace.id,- primary: workspace.domains.length === 0,- },- }),- ]);+ const response = await prisma.domain.create({+ data: {+ slug: domain,+ target,+ type,+ projectId: workspace.id,+ primary: workspace.domains.length === 0,+ },+ });await setRootDomain({- id: response[0].id,+ id: response.id,domain,projectId: workspace.id,...(workspace.plan !== "free" && {