Skip to content

Commit a719118

Browse files
committed
Fixes bug where session logout returned error.
Summary: redirectWithErrorMessage is async, but the call site was missing await — so throw was throwing a Promise<Response> instead of a Response. Remix navigation paths happened to coerce it, but fetcher loaders (like the /resources/platform-changelogs poll) blew up with a 500. Adding await fixes both.
1 parent a3d7239 commit a719118

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

apps/webapp/app/services/session.server.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { redirect } from "@remix-run/node";
2+
import { redirectWithErrorMessage } from "~/models/message.server";
23
import { getUserById } from "~/models/user.server";
34
import { sanitizeRedirectPath } from "~/utils";
45
import { authenticator } from "./auth.server";
@@ -31,7 +32,12 @@ export async function getUserId(request: Request): Promise<string | undefined> {
3132
const session = await getUserSession(request);
3233
const { durationSeconds } = await getEffectiveSessionDuration(authUser.userId);
3334
if (isSessionExpired(session, durationSeconds)) {
34-
throw await logout(request);
35+
throw await redirectWithErrorMessage(
36+
"/logout",
37+
request,
38+
"You were signed out due to inactivity.",
39+
{ ephemeral: false }
40+
);
3541
}
3642

3743
return authUser.userId;

0 commit comments

Comments
 (0)