Skip to content

Commit aa87d5b

Browse files
authored
Merge pull request #2476 from dubinc/log-record-click
Log rejected promises when recording clicks
2 parents 5be6625 + bafaf4f commit aa87d5b

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

apps/web/lib/tinybird/record-click.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ export async function recordClick({
149149

150150
const hasWebhooks = webhookIds && webhookIds.length > 0;
151151

152-
const [, , , , workspaceRows] = await Promise.allSettled([
152+
const response = await Promise.allSettled([
153153
fetchWithRetry(
154154
`${process.env.TINYBIRD_API_URL}/v0/events?name=dub_click_events&wait=true`,
155155
{
@@ -194,6 +194,14 @@ export async function recordClick({
194194
: null,
195195
]);
196196

197+
// Find the rejected promises and log them
198+
if (response.some((result) => result.status === "rejected")) {
199+
const errors = response.filter((result) => result.status === "rejected");
200+
console.error("[Record click] - Rejected promises", errors);
201+
}
202+
203+
const [, , , , workspaceRows] = response;
204+
197205
const workspace =
198206
workspaceRows.status === "fulfilled" &&
199207
workspaceRows.value &&

0 commit comments

Comments
 (0)