diff --git a/CHANGELOG.md b/CHANGELOG.md index 5e8fe76ca6..1e6176b264 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,7 +24,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed +- Resolved a startup error in data gathering caused by uninitialized data provider mappings - Improved the error handling in the `HtmlTemplateMiddleware` +- Improved the error handling in the get quotes functionality of the _Financial Modeling Prep_ service ## 3.26.0 - 2026-07-14 diff --git a/apps/api/src/services/data-provider/data-provider.service.ts b/apps/api/src/services/data-provider/data-provider.service.ts index 8723466b03..09bf1108eb 100644 --- a/apps/api/src/services/data-provider/data-provider.service.ts +++ b/apps/api/src/services/data-provider/data-provider.service.ts @@ -44,7 +44,7 @@ import { AssetProfileInvalidError } from './errors/asset-profile-invalid.error'; export class DataProviderService implements OnModuleInit { private readonly logger = new Logger(DataProviderService.name); - private dataProviderMapping: { [dataProviderName: string]: string }; + private dataProviderMapping: { [dataProviderName: string]: string } = {}; public constructor( private readonly configurationService: ConfigurationService, diff --git a/apps/api/src/services/data-provider/financial-modeling-prep/financial-modeling-prep.service.ts b/apps/api/src/services/data-provider/financial-modeling-prep/financial-modeling-prep.service.ts index ec4aa39c05..4e3502033b 100644 --- a/apps/api/src/services/data-provider/financial-modeling-prep/financial-modeling-prep.service.ts +++ b/apps/api/src/services/data-provider/financial-modeling-prep/financial-modeling-prep.service.ts @@ -47,7 +47,7 @@ import { isSameDay, parseISO } from 'date-fns'; -import { uniqBy } from 'lodash'; +import { isArray, uniqBy } from 'lodash'; @Injectable() export class FinancialModelingPrepService @@ -440,10 +440,14 @@ export class FinancialModelingPrepService signal: AbortSignal.timeout(requestTimeout) } ) - .then( - (res) => - res.json() as unknown as { price: number; symbol: string }[] - ) + .then(async (res) => { + const json = (await res.json()) as unknown as { + price: number; + symbol: string; + }[]; + + return isArray(json) ? json : []; + }) ]); for (const { currency, symbolTarget } of assetProfileResolutions) {