Skip to content

Commit

Permalink
fix(server): fix crash when session token returns no data in auth mid…
Browse files Browse the repository at this point in the history
…dleware
  • Loading branch information
dyc3 committed Nov 7, 2024
1 parent e327ab5 commit 4ea0cc0
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion server/auth/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,11 @@ export async function authTokenMiddleware(
return;
}

req.ottsession = await tokens.getSessionInfo(req.token);
try {
req.ottsession = await tokens.getSessionInfo(req.token);
} catch (err) {
log.warn(`Error getting session info in auth middleware: ${err}`);

Check warning on line 75 in server/auth/index.ts

View check run for this annotation

Codecov / codecov/patch

server/auth/index.ts#L75

Added line #L75 was not covered by tests
}
if (!req.ottsession) {
res.status(401).json({
success: false,
Expand Down

0 comments on commit 4ea0cc0

Please sign in to comment.