Skip to content

Commit e55cc21

Browse files
committed
Update route.ts
1 parent d318ba7 commit e55cc21

File tree

1 file changed

+4
-9
lines changed
  • apps/web/app/(ee)/api/email-domains

1 file changed

+4
-9
lines changed

apps/web/app/(ee)/api/email-domains/route.ts

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -92,18 +92,13 @@ export const POST = withWorkspace(
9292
},
9393
});
9494

95-
waitUntil(
96-
(async () => {
97-
const { error } = await resend.domains.verify(resendDomain.id);
98-
99-
if (error) {
100-
console.error("Error verifying resend domain", error);
101-
}
102-
})(),
103-
);
95+
waitUntil(resend.domains.verify(resendDomain.id));
10496

10597
return NextResponse.json(EmailDomainSchema.parse(emailDomain));
10698
} catch (error) {
99+
// Cleanup to avoid orphaned Resend domains
100+
waitUntil(resend.domains.remove(resendDomain.id));
101+
107102
if (error instanceof Prisma.PrismaClientKnownRequestError) {
108103
if (error.code === "P2002") {
109104
throw new DubApiError({

0 commit comments

Comments
 (0)