From 550caa66658090f1d0958749c44d30c3b1355f8f Mon Sep 17 00:00:00 2001 From: an_ifrah24 <137814364+ifrah-ashraf@users.noreply.github.com> Date: Sun, 14 Dec 2025 18:05:57 +0530 Subject: [PATCH] fix: added conditional check for the unkey logger to reduce the number of logs (#25858) --- packages/lib/rateLimit.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/lib/rateLimit.ts b/packages/lib/rateLimit.ts index 5a0723774f..ebdc90460a 100644 --- a/packages/lib/rateLimit.ts +++ b/packages/lib/rateLimit.ts @@ -28,11 +28,16 @@ export type RateLimitHelper = { export const API_KEY_RATE_LIMIT = 30; +let warned = false; + export function rateLimiter() { const { UNKEY_ROOT_KEY } = process.env; if (!UNKEY_ROOT_KEY) { - log.warn("Disabled because the UNKEY_ROOT_KEY environment variable was not found."); + if (!warned) { + log.warn("Disabled because the UNKEY_ROOT_KEY environment variable was not found."); + warned = true; + } return () => ({ success: true, limit: 10, remaining: 999, reset: 0 } as RatelimitResponse); } const timeout = {