The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
use waitUntil
Kiran Ka641b0cb49d5
diff --git a/apps/web/app/api/links/route.ts b/apps/web/app/api/links/route.tsindex 73715cbf90..363d5fcc85 100644--- a/apps/web/app/api/links/route.ts+++ b/apps/web/app/api/links/route.ts@@ -13,6 +13,7 @@ import {LOCALHOST_IP,getSearchParamsWithArray,} from "@dub/utils";+import { waitUntil } from "@vercel/functions";import { NextResponse } from "next/server";// GET /api/links – get all links for a workspace@@ -86,15 +87,20 @@ export const POST = withWorkspace(try {const response = await createLink(link);- // Publish to Zapier if the project has a Zapier hook enabled- if (response.projectId && workspace.zapierHookEnabled) {- await qstash.publishJSON({- url: `${APP_DOMAIN_WITH_NGROK}/api/zapier/send-webhook`,- body: {- linkId: response.id,- },- });- }+ waitUntil(+ (async () => {+ console.log("Publishing to Zapier");+ // Publish to Zapier if the project has a Zapier hook enabled+ if (response.projectId && workspace.zapierHookEnabled) {+ await qstash.publishJSON({+ url: `${APP_DOMAIN_WITH_NGROK}/api/zapier/send-webhook`,+ body: {+ linkId: response.id,+ },+ });+ }+ })(),+ );return NextResponse.json(response, { headers });} catch (error) {