The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
final change
Steven Teybcbc14e35e58
diff --git a/apps/web/app/(ee)/api/track/click/route.ts b/apps/web/app/(ee)/api/track/click/route.tsindex b76584557f..82b333f78d 100644--- a/apps/web/app/(ee)/api/track/click/route.ts+++ b/apps/web/app/(ee)/api/track/click/route.ts@@ -92,7 +92,7 @@ export const POST = withAxiom(async (req: AxiomRequest) => {if (!cachedLink.projectId) {throw new DubApiError({code: "not_found",- message: "Link not found.",+ message: "Link does not belong to a workspace.",});}@@ -106,7 +106,7 @@ export const POST = withAxiom(async (req: AxiomRequest) => {if (!cachedClickId) {if (!cachedAllowedHostnames) {const workspace = await getWorkspaceViaEdge({- workspaceId: cachedLink.projectId!,+ workspaceId: cachedLink.projectId,includeDomains: true,});diff --git a/apps/web/lib/tinybird/record-click.ts b/apps/web/lib/tinybird/record-click.tsindex c2a14753df..8e19078019 100644--- a/apps/web/lib/tinybird/record-click.ts+++ b/apps/web/lib/tinybird/record-click.ts@@ -151,8 +151,6 @@ export async function recordClick({referer_url: referer || "(direct)",};- const hasWebhooks = webhookIds && webhookIds.length > 0;-if (shouldCacheClickId) {// cache the click ID and its corresponding click data in Redis for 5 mins// we're doing this because ingested click events are not available immediately in Tinybird@@ -225,6 +223,7 @@ export async function recordClick({}// if the link has webhooks enabled, we need to check if the workspace usage has exceeded the limit+ const hasWebhooks = webhookIds && webhookIds.length > 0;if (workspaceId && hasWebhooks) {const workspaceRows = await conn.execute("SELECT usage, usageLimit FROM Project WHERE id = ? LIMIT 1",@@ -243,7 +242,7 @@ export async function recordClick({workspaceData && workspaceData.usage >= workspaceData.usageLimit;// Send webhook events if link has webhooks enabled and the workspace usage has not exceeded the limit- if (hasWebhooks && !hasExceededUsageLimit) {+ if (!hasExceededUsageLimit) {await sendLinkClickWebhooks({ webhookIds, linkId, clickData });}}