From 0c0cc93f57be2a6928b593e6f9d2529abb75e888 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 5 May 2026 23:14:04 +0000 Subject: [PATCH] fix(api): require user fmp api key --- backend/src/services/apiServer.ts | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/backend/src/services/apiServer.ts b/backend/src/services/apiServer.ts index 391090e..d483c2c 100644 --- a/backend/src/services/apiServer.ts +++ b/backend/src/services/apiServer.ts @@ -130,15 +130,6 @@ const normalizeNewsSymbolsQuery = (value: unknown): string => { return symbols.join(','); }; -const getConfiguredFmpApiKey = (): string => { - const apiKey = config.FMP_API_KEY.trim(); - if (!apiKey || apiKey.toLowerCase() === 'demo') { - throw new MissingServiceConfigError('FMP_API_KEY is required for research and screener endpoints'); - } - - return apiKey; -}; - async function getUserFmpApiKey(userId: string): Promise { const profile = await getCurrentUserProfile(userId); const profileApiKey = String(profile.FMP_API_KEY || '').trim(); @@ -146,7 +137,7 @@ async function getUserFmpApiKey(userId: string): Promise { return profileApiKey; } - return getConfiguredFmpApiKey(); + throw new MissingServiceConfigError('User FMP API key is required for research and screener endpoints'); } class MissingServiceConfigError extends Error {