rp
12/23/2021, 5:55 AMgetSession
throws a TRY_REFRESH_TOKEN
error, then you need to send a 401 to the frontend. This can happen if a session exists, but the access token has expired. So your code should change to like:
try {
const existingSession = await Session.getSession(...)
...
return {
id: data.id,
...
}
} catch {
if (err.type === Session.Error.TRY_REFRESH_TOKEN) {
// return 401 to frontend
} else {
return InternalServerError(error);
}
}