From 8aa82a249b992cc551b69cd609f6b15243741734 Mon Sep 17 00:00:00 2001 From: sreecharan-desu Date: Thu, 12 Feb 2026 10:04:10 +0530 Subject: [PATCH 1/2] fix(auth-server): safely access metrics methods in redis --- packages/fxa-auth-server/test/local/redis.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/fxa-auth-server/test/local/redis.js b/packages/fxa-auth-server/test/local/redis.js index 534ec29cc93..3d922d9ef1c 100644 --- a/packages/fxa-auth-server/test/local/redis.js +++ b/packages/fxa-auth-server/test/local/redis.js @@ -7,9 +7,13 @@ const { assert } = require('chai'); const AccessToken = require('../../lib/oauth/db/accessToken'); const RefreshTokenMetadata = require('../../lib/oauth/db/refreshTokenMetadata'); +const { Container } = require('typedi'); +const { StatsD } = require('hot-shots'); const config = require('../../config').default.getProperties(); const mocks = require('../mocks'); +Container.set(StatsD, mocks.mockStatsd()); + const recordLimit = 20; const prefix = 'test:'; const maxttl = 1337; From 4661a977c5e7e535c406ea21ecf7f863d0eca956 Mon Sep 17 00:00:00 2001 From: sreecharan-desu Date: Thu, 12 Feb 2026 10:09:21 +0530 Subject: [PATCH 2/2] docs(auth-server): add comment for redis test mock injection --- packages/fxa-auth-server/test/local/redis.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/fxa-auth-server/test/local/redis.js b/packages/fxa-auth-server/test/local/redis.js index 3d922d9ef1c..9b78577e95f 100644 --- a/packages/fxa-auth-server/test/local/redis.js +++ b/packages/fxa-auth-server/test/local/redis.js @@ -12,6 +12,9 @@ const { StatsD } = require('hot-shots'); const config = require('../../config').default.getProperties(); const mocks = require('../mocks'); +// Inject a mock StatsD into the global Container before the redis module is +// initialized. This prevents crashes when the redis module attempts to report +// metrics during initialization or tests. Container.set(StatsD, mocks.mockStatsd()); const recordLimit = 20;