From eff1d642cfd3502f479761a3bb76a543ae0166af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karol=20S=C3=B3jko?= Date: Thu, 28 Dec 2023 16:39:32 +0100 Subject: [PATCH] fix(auth): missing return statement in lock middleware --- packages/auth/bin/server.ts | 10 ++++++++-- .../InversifyExpressUtils/Middleware/LockMiddleware.ts | 2 ++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/packages/auth/bin/server.ts b/packages/auth/bin/server.ts index 58c62dbbd..be4d66933 100644 --- a/packages/auth/bin/server.ts +++ b/packages/auth/bin/server.ts @@ -58,8 +58,14 @@ void container.load().then((container) => { const logger: winston.Logger = container.get(TYPES.Auth_Logger) server.setErrorConfig((app) => { - app.use((error: Record, _request: Request, response: Response, _next: NextFunction) => { - logger.error(error.stack) + app.use((error: Record, request: Request, response: Response, _next: NextFunction) => { + logger.error(`${error.stack}`, { + method: request.method, + url: request.url, + snjs: request.headers['x-snjs-version'], + application: request.headers['x-application-version'], + userId: response.locals.user ? response.locals.user.uuid : undefined, + }) response.status(500).send({ error: { diff --git a/packages/auth/src/Infra/InversifyExpressUtils/Middleware/LockMiddleware.ts b/packages/auth/src/Infra/InversifyExpressUtils/Middleware/LockMiddleware.ts index cba8e1eb6..6bf265749 100644 --- a/packages/auth/src/Infra/InversifyExpressUtils/Middleware/LockMiddleware.ts +++ b/packages/auth/src/Infra/InversifyExpressUtils/Middleware/LockMiddleware.ts @@ -26,6 +26,8 @@ export class LockMiddleware extends BaseMiddleware { message: usernameOrError.getError(), }, }) + + return } const username = usernameOrError.getValue()