Production Deployment Fixes and Enhancements #3

Merged
ilia merged 38 commits from dev into main 2026-01-04 16:37:35 -05:00
Showing only changes of commit 76cd2782ec - Show all commits

View File

@ -11,17 +11,25 @@ export async function proxy(request: NextRequest) {
}
// Get token (works in Edge runtime)
// getToken automatically detects the cookie name from NextAuth config
// Explicitly specify the cookie name to match NextAuth config
const cookieName = "__Secure-authjs.session-token"
const token = await getToken({
req: request,
secret: process.env.NEXTAUTH_SECRET
secret: process.env.NEXTAUTH_SECRET,
cookieName: cookieName
})
// Debug logging for production troubleshooting
const cookieHeader = request.headers.get("cookie") || ""
const hasCookie = cookieHeader.includes(cookieName)
if (!token) {
console.log("Middleware: No token found", {
pathname,
cookieHeader: request.headers.get("cookie")?.substring(0, 200),
cookieName,
hasCookie,
cookieHeader: cookieHeader.substring(0, 300),
allCookies: cookieHeader.split(";").map(c => c.trim().substring(0, 50)),
origin: request.headers.get("origin"),
referer: request.headers.get("referer")
})