From c0276db6e3f28b45ff4451bc22abcf7939f6b79c Mon Sep 17 00:00:00 2001 From: Mike Cao Date: Thu, 11 Aug 2022 12:11:43 -0700 Subject: [PATCH] Fixed session check logic. Closes #1340. --- lib/session.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/session.js b/lib/session.js index 7c4476d6..c9fb04d7 100644 --- a/lib/session.js +++ b/lib/session.js @@ -49,17 +49,17 @@ export async function getSession(req) { country, device, }); - - if (!session) { - return null; - } } catch (e) { - if (!e.message.includes('Unique constraint')) { + if (!e.message.toLowerCase().includes('unique constraint')) { throw e; } } } + if (!session) { + return null; + } + const { session_id } = session; return {