diff --git a/api-gateway/src/helpers/interceptors/utils/hash.ts b/api-gateway/src/helpers/interceptors/utils/hash.ts index 0c14e7029..637911ee6 100644 --- a/api-gateway/src/helpers/interceptors/utils/hash.ts +++ b/api-gateway/src/helpers/interceptors/utils/hash.ts @@ -4,5 +4,5 @@ import crypto from 'crypto'; import {IAuthUser} from '@guardian/common'; export function getHash(user: IAuthUser | null): string { - return crypto.createHash('md5').update(JSON.stringify(user.id ?? 'anonymous')).digest('hex'); + return crypto.createHash('md5').update(JSON.stringify(user?.id ?? 'anonymous')).digest('hex'); }