From 60a4db00800226b1bd3d7e270226001d70b2b1d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerg=C5=91=20M=C3=B3ricz?= Date: Mon, 23 Jun 2025 19:02:58 +0200 Subject: [PATCH] fix(v1): check credits variable scope collision MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is what’s been causing the weird insufficient credits errors. --- apps/api/src/routes/v1.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/api/src/routes/v1.ts b/apps/api/src/routes/v1.ts index 61f1d539d..cfb98cbe7 100644 --- a/apps/api/src/routes/v1.ts +++ b/apps/api/src/routes/v1.ts @@ -38,9 +38,10 @@ import { tokenUsageController } from "../controllers/v1/token-usage"; import { ongoingCrawlsController } from "../controllers/v1/crawl-ongoing"; function checkCreditsMiddleware( - minimum?: number, + _minimum?: number, ): (req: RequestWithAuth, res: Response, next: NextFunction) => void { return (req, res, next) => { + let minimum = _minimum; (async () => { if (!minimum && req.body) { minimum =