From 1b5b2431b36017a059d8111cde83e07af4a8bcf5 Mon Sep 17 00:00:00 2001 From: Ricardo Campos Date: Thu, 18 Jun 2026 15:57:39 -0300 Subject: [PATCH] fix: 500 auth error on vercel --- auth.config.ts | 3 +++ middleware.ts | 7 ++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/auth.config.ts b/auth.config.ts index 3bf6252..014278b 100644 --- a/auth.config.ts +++ b/auth.config.ts @@ -4,6 +4,9 @@ export const authConfig = { pages: { signIn: "/login", }, + trustHost: + process.env.NODE_ENV === "development" || + process.env.NEXTAUTH_URL === "https://black-espresso-eventme.vercel.app", session: { strategy: "jwt", }, diff --git a/middleware.ts b/middleware.ts index 2803dd2..9b533f2 100644 --- a/middleware.ts +++ b/middleware.ts @@ -1,7 +1,12 @@ import NextAuth from "next-auth"; import { authConfig } from "./auth.config"; -export const { auth } = NextAuth(authConfig); +export const { auth } = NextAuth({ + ...authConfig, + trustHost: + process.env.NODE_ENV === "development" || + process.env.NEXTAUTH_URL === "https://black-espresso-eventme.vercel.app", +}); export default auth((req) => { const isLoggedIn = !!req.auth;