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.

put try catch in waitUntil

Steven Tey147631248828
diff --git a/apps/web/app/api/links/crawl/bitly/[domain]/[key]/route.ts b/apps/web/app/api/links/crawl/bitly/[domain]/[key]/route.ts
index bb649c2e48..e03216c95c 100644
--- a/apps/web/app/api/links/crawl/bitly/[domain]/[key]/route.ts
+++ b/apps/web/app/api/links/crawl/bitly/[domain]/[key]/route.ts
@@ -60,31 +60,28 @@ export const GET = async (_req: NextRequest, { params }) => {
`[Bitly] Creating link ${newLink.shortLink} -> ${newLink.url}`,
);
- try {
- waitUntil(
- conn.execute(
- "INSERT INTO Link (id, projectId, userId, domain, `key`, url, shortLink, archived, folderId, createdAt, updatedAt) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",
- [
- newLink.id,
- newLink.projectId,
- newLink.userId,
- newLink.domain,
- newLink.key,
- newLink.url,
- newLink.shortLink,
- newLink.archived,
- newLink.folderId,
- newLink.createdAt,
- newLink.updatedAt,
- ],
- ),
- );
- } catch (error) {
- console.error(
- `[Bitly] Error creating link ${newLink.shortLink} -> ${newLink.url}`,
- error,
- );
- }
+ waitUntil(
+ (async () => {
+ try {
+ await conn.execute(
+ "INSERT INTO Link (id, projectId, userId, domain, `key`, url, shortLink, archived, folderId, createdAt, updatedAt) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",
+ [
+ newLink.id,
+ newLink.projectId,
+ newLink.userId,
+ newLink.domain,
+ newLink.key,
+ newLink.url,
+ newLink.shortLink,
+ newLink.archived,
+ newLink.folderId,
+ newLink.createdAt,
+ newLink.updatedAt,
+ ],
+ );
+ } catch (_e) {}
+ })(),
+ );
return NextResponse.redirect(sanitizedUrl, {
headers: DUB_HEADERS,