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.

Fix the failure threshold value in the webhooks email templates

Kiran Kbc2a139c7d71
diff --git a/apps/web/lib/webhook/failure.ts b/apps/web/lib/webhook/failure.ts
index c61734f74c..474123fae0 100644
--- a/apps/web/lib/webhook/failure.ts
+++ b/apps/web/lib/webhook/failure.ts
@@ -119,6 +119,7 @@ const notifyWebhookFailure = async (
id: webhook.id,
url: webhook.url,
consecutiveFailures: webhook.consecutiveFailures,
+ disableThreshold: WEBHOOK_FAILURE_DISABLE_THRESHOLD,
},
}),
});
@@ -164,6 +165,7 @@ const notifyWebhookDisabled = async (
webhook: {
id: webhook.id,
url: webhook.url,
+ disableThreshold: WEBHOOK_FAILURE_DISABLE_THRESHOLD,
},
}),
});
diff --git a/packages/email/src/templates/webhook-disabled.tsx b/packages/email/src/templates/webhook-disabled.tsx
index ee3c688b6d..aad5815a29 100644
--- a/packages/email/src/templates/webhook-disabled.tsx
+++ b/packages/email/src/templates/webhook-disabled.tsx
@@ -1,4 +1,3 @@
-// import { WEBHOOK_FAILURE_DISABLE_THRESHOLD } from "@/lib/webhook/constants";
import { DUB_WORDMARK } from "@dub/utils";
import {
Body,
@@ -24,6 +23,7 @@ export default function WebhookDisabled({
webhook = {
id: "wh_tYedrqsWgNJxUwQOaAnupcUJ1",
url: "https://example.com/webhook",
+ disableThreshold: 20,
},
}: {
email: string;
@@ -34,6 +34,7 @@ export default function WebhookDisabled({
webhook: {
id: string;
url: string;
+ disableThreshold: number;
};
}) {
return (
@@ -56,8 +57,8 @@ export default function WebhookDisabled({
</Heading>
<Text className="text-sm leading-6 text-black">
Your webhook <strong>{webhook.url}</strong> has failed to deliver
- successfully 20 times in a row and has been deactivated to prevent
- further issues.
+ successfully {webhook.disableThreshold} times in a row and has
+ been deactivated to prevent further issues.
</Text>
<Text className="text-sm leading-6 text-black">
Please review the webhook details and update the URL if necessary
diff --git a/packages/email/src/templates/webhook-failed.tsx b/packages/email/src/templates/webhook-failed.tsx
index 52f3a56a27..5b1235e67c 100644
--- a/packages/email/src/templates/webhook-failed.tsx
+++ b/packages/email/src/templates/webhook-failed.tsx
@@ -1,4 +1,3 @@
-import { WEBHOOK_FAILURE_DISABLE_THRESHOLD } from "@/lib/webhook/constants";
import { DUB_WORDMARK } from "@dub/utils";
import {
Body,
@@ -25,6 +24,7 @@ export default function WebhookFailed({
id: "wh_tYedrqsWgNJxUwQOaAnupcUJ1",
url: "https://example.com/webhook",
consecutiveFailures: 15,
+ disableThreshold: 20,
},
}: {
email: string;
@@ -36,6 +36,7 @@ export default function WebhookFailed({
id: string;
url: string;
consecutiveFailures: number;
+ disableThreshold: number;
};
}) {
return (
@@ -59,7 +60,7 @@ export default function WebhookFailed({
<Text className="text-sm leading-6 text-black">
Your webhook <strong>{webhook.url}</strong> has failed to deliver{" "}
{webhook.consecutiveFailures} times and will be disabled after{" "}
- {WEBHOOK_FAILURE_DISABLE_THRESHOLD} consecutive failures.
+ {webhook.disableThreshold} consecutive failures.
</Text>
<Text className="text-sm leading-6 text-black">
Please review the webhook details and update the URL if necessary