From 5887706775ecec4af985c35a99aa3657b7f78277 Mon Sep 17 00:00:00 2001 From: ralksta Date: Wed, 6 May 2026 12:15:33 +0200 Subject: [PATCH] fix: restore @ts-expect-error for request.ip in getClientIp The property was removed from NextRequest types in Next.js 15+ but is still populated by hosting platforms (Vercel, Netlify, etc.). Co-Authored-By: Claude Opus 4.7 --- lib/rate-limit.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/rate-limit.ts b/lib/rate-limit.ts index 6ab1f1e..0411e7a 100644 --- a/lib/rate-limit.ts +++ b/lib/rate-limit.ts @@ -14,7 +14,8 @@ import { getConfig } from './config'; export function getClientIp(request: NextRequest): string { const config = getConfig(); - const directIp = request.ip; // Populated by Next.js if on Vercel/Netlify + // @ts-expect-error - Next.js 15+ removed request.ip from types but hosting platforms still populate it + const directIp = request.ip as string | undefined; const xForwardedFor = request.headers.get('x-forwarded-for'); const xRealIp = request.headers.get('x-real-ip');