fix(auth): missing return statement in lock middleware

This commit is contained in:
Karol Sójko 2023-12-28 16:39:32 +01:00
parent a05d7afe00
commit eff1d642cf
No known key found for this signature in database
GPG key ID: C2F813669419D05F
2 changed files with 10 additions and 2 deletions

View file

@ -58,8 +58,14 @@ void container.load().then((container) => {
const logger: winston.Logger = container.get(TYPES.Auth_Logger) const logger: winston.Logger = container.get(TYPES.Auth_Logger)
server.setErrorConfig((app) => { server.setErrorConfig((app) => {
app.use((error: Record<string, unknown>, _request: Request, response: Response, _next: NextFunction) => { app.use((error: Record<string, unknown>, request: Request, response: Response, _next: NextFunction) => {
logger.error(error.stack) 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({ response.status(500).send({
error: { error: {

View file

@ -26,6 +26,8 @@ export class LockMiddleware extends BaseMiddleware {
message: usernameOrError.getError(), message: usernameOrError.getError(),
}, },
}) })
return
} }
const username = usernameOrError.getValue() const username = usernameOrError.getValue()