feat: add more logging for error debugging

This commit is contained in:
lucas-neynar 2025-04-10 10:56:48 -07:00
parent b3e419b1f6
commit 6c35293e80
No known key found for this signature in database
2 changed files with 14 additions and 2 deletions

View File

@ -9,7 +9,7 @@ import { fileURLToPath } from 'url';
dotenv.config({ path: '.env.local' });
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const projectRoot = path.join(__dirname, '..');
const projectRoot = path.resolve(path.normalize(path.join(__dirname, '..')));
let tunnel;
let nextDev;

View File

@ -58,6 +58,11 @@ export const authOptions: AuthOptions = {
},
async authorize(credentials, req) {
const csrfToken = req?.body?.csrfToken;
if (!csrfToken) {
console.error('CSRF token is missing from request');
return null;
}
const appClient = createAppClient({
ethereum: viemConnector(),
});
@ -120,4 +125,11 @@ export const authOptions: AuthOptions = {
}
}
export const getSession = () => getServerSession(authOptions)
export const getSession = async () => {
try {
return await getServerSession(authOptions);
} catch (error) {
console.error('Error getting server session:', error);
return null;
}
}