diff --git a/src/auth/authHandler.ts b/src/auth/authHandler.ts index bfd5058..6a0b332 100644 --- a/src/auth/authHandler.ts +++ b/src/auth/authHandler.ts @@ -6,7 +6,7 @@ export const tokenHandler = (claim: string) => { return async (request: FastifyRequest, reply: FastifyReply): Promise => { const logContext = 'tokenHandler()'; const authHeader = request.headers.authorization; - if (!authHeader || !authHeader.startsWith('Bearer ') || !claim) { + if (!authHeader?.startsWith('Bearer ') || !claim) { reply.code(401).send({ error: 'Unauthorized' }); return; }