diff --git a/lib/handlers/router-entities/route-caching/dynamo-route-caching-provider.ts b/lib/handlers/router-entities/route-caching/dynamo-route-caching-provider.ts index e31396ec3a..f5b584b61d 100644 --- a/lib/handlers/router-entities/route-caching/dynamo-route-caching-provider.ts +++ b/lib/handlers/router-entities/route-caching/dynamo-route-caching-provider.ts @@ -167,7 +167,7 @@ export class DynamoRouteCachingProvider extends IRouteCachingProvider { ): CachedRoutes { metric.putMetric(`RoutesDbEntriesFound`, result.Items!.length, MetricLoggerUnit.Count) const cachedRoutesArr: CachedRoutes[] = result.Items!.map((record) => { - if (record.plainRoutes?.toString().trim() !== '') { + if (record.plainRoutes && record.plainRoutes?.toString().trim() !== '') { metric.putMetric(`RoutesDbEntryPlainTextRouteFound`, 1, MetricLoggerUnit.Count) const cachedRoutesJson = JSON.parse(record.plainRoutes) diff --git a/test/mocha/integ/handlers/router-entities/route-caching/dynamo-route-caching-provider.test.ts b/test/mocha/integ/handlers/router-entities/route-caching/dynamo-route-caching-provider.test.ts index 8e2283ac81..4aaf7c1b64 100644 --- a/test/mocha/integ/handlers/router-entities/route-caching/dynamo-route-caching-provider.test.ts +++ b/test/mocha/integ/handlers/router-entities/route-caching/dynamo-route-caching-provider.test.ts @@ -175,6 +175,7 @@ describe('DynamoRouteCachingProvider', async () => { it('Cached routes hits new cached routes lambda', async () => { spy.withArgs('CachingQuoteForRoutesDbRequestSentToLambdanewcachinglambda', 1, MetricLoggerUnit.Count) + spy.withArgs('RoutesDbEntryPlainTextRouteFound', 1, MetricLoggerUnit.Count) // testnet rolls out at 100% const newCachedRoutesRolloutPercent = NEW_CACHED_ROUTES_ROLLOUT_PERCENT[ChainId.SEPOLIA]