Skip to content

Open source alternative to Semrush and Ahrefs

fix: add 10s timeout to Loops fetches (#543)

Ben Senescu0abde8010965
diff --git a/src/server/email/loops-client.ts b/src/server/email/loops-client.ts
index 4810760b..aecd3702 100644
--- a/src/server/email/loops-client.ts
+++ b/src/server/email/loops-client.ts
@@ -35,6 +35,7 @@ export async function updateLoopsContact({
Authorization: `Bearer ${apiKey}`,
},
body: JSON.stringify(payload),
+ signal: AbortSignal.timeout(10_000),
});
if (response.ok) {
@@ -42,7 +43,7 @@ export async function updateLoopsContact({
}
const errorPayload = await response.json().catch(() => null);
- console.error("Loops contact update error:", {
+ console.warn("Loops contact update error:", {
status: response.status,
email: payload.email,
userId: payload.userId,
diff --git a/src/server/email/loops.ts b/src/server/email/loops.ts
index 0a30440f..cea0074d 100644
--- a/src/server/email/loops.ts
+++ b/src/server/email/loops.ts
@@ -58,6 +58,7 @@ async function sendLoopsTransactionalEmail({
addToAudience: false,
dataVariables,
}),
+ signal: AbortSignal.timeout(10_000),
});
if (response.ok) {