auth fix?
CI/CD Pipeline / Build and Push App Docker Image (push) Successful in 2m55s
CI/CD Pipeline / Build and Push PocketBase Docker Image (push) Successful in 8s
CI/CD Pipeline / Deploy to Kubernetes (push) Failing after 2m36s

This commit is contained in:
2026-07-11 13:11:45 -07:00
parent e67f6b073c
commit ec334bbed4
6 changed files with 32 additions and 15 deletions
+13 -5
View File
@@ -14,6 +14,8 @@ import { serverFnLoggingMiddleware } from "./activities";
import { pbAdmin } from "@/lib/pocketbase/client";
const logger = new Logger("Middleware");
export const PUBLIC_ROUTES = ["/login", "/logout", "/refresh-session"];
const verifySuperTokensSession = async (
request: Request
) => {
@@ -55,12 +57,18 @@ export const getSessionContext = createServerOnlyFn(async (request: Request, opt
if (options?.isServerFunction) {
throw new Error("SESSION_REFRESH_REQUIRED");
}
const url = new URL(request.url);
const from = encodeURIComponent(url.pathname + url.search);
throw redirect({
to: "/refresh-session",
search: { redirect: from }
if (PUBLIC_ROUTES.some((route) => url.pathname.startsWith(route))) {
throw new Error("Unauthenticated");
}
const from = url.pathname + url.search;
throw redirect({
to: "/refresh-session",
search: from === "/" ? {} : { redirect: from },
});
}