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 {