Fix: prevent 500s when auth not enabled

This commit is contained in:
shamoon
2026-08-07 08:25:52 -07:00
parent 97fef182ce
commit c8690f64da
2 changed files with 52 additions and 17 deletions
+13 -1
View File
@@ -150,4 +150,16 @@ export const authOptions = {
},
};
export default NextAuth(authOptions);
const nextAuthHandler = NextAuth(authOptions);
export default async function handler(req, res) {
// Just pass empty session if auth not enabled
if (!authEnabled) {
if (req.query.nextauth?.[0] === "session") {
return res.status(200).json({});
}
return res.status(404).end("Not Found");
}
return nextAuthHandler(req, res);
}