From 55fb1a8b3491dea3be13bdf27ba488ea3400a4f7 Mon Sep 17 00:00:00 2001 From: Arthur Simas Date: Thu, 23 Jun 2022 23:38:24 -0300 Subject: [PATCH] FIX: suppressing health check not authenticated log --- src/authentication/authentication.guard.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/authentication/authentication.guard.ts b/src/authentication/authentication.guard.ts index bf4fbf2..f4d3454 100644 --- a/src/authentication/authentication.guard.ts +++ b/src/authentication/authentication.guard.ts @@ -123,7 +123,11 @@ export class AuthenticationGuard jwt.verify(accessToken, pemValue); accessTokenPayload = accessTokenDecoded.payload; } catch (err) { - this.logger.log('Unable to verify duc access token\n' + err.stack); + // only log if it's not a health check request + if (`${request.method} ${request.route.path}` !== 'GET /health') { + this.logger.log('Unable to verify duc access token\n' + err.stack); + } + return false; }