Last Updated: 2026-03-15 | Version: 1.5.0
export async function POST(req: Request) {
console.log('π₯ Request received:', new Date().toISOString());
const body = await req.json();
console.log('π¦ Body:', JSON.stringify(body, null, 2));
// ... rest of handler
}View logs: npm run dev terminal output.
Create .vscode/launch.json:
{
"version": "0.2.0",
"configurations": [
{
"name": "Next.js: debug server-side",
"type": "node-terminal",
"request": "launch",
"command": "npm run dev"
},
{
"name": "Next.js: debug client-side",
"type": "chrome",
"request": "launch",
"url": "http://localhost:3000"
}
]
}Enable Prisma query logging:
// src/lib/database.ts
export const prisma = new PrismaClient({
log: process.env.NODE_ENV === 'development'
? ['query', 'error', 'warn']
: ['error'],
});This logs all SQL queries to the terminal.
// Add verbose logging to sync service
async function syncPlatform(userId: string, platform: UserPlatform) {
console.log(`π Syncing ${platform.platform.name} for user ${userId}`);
try {
const result = await scraper.scrape(config);
console.log(`β
Scraped ${result.length} entries`);
return result;
} catch (error) {
console.error(`β Sync failed for ${platform.platform.name}:`, error);
throw error;
}
}// Temporary: Log session in API route
export async function GET(req: Request) {
const session = await getServerSession(authOptions);
console.log('Session:', JSON.stringify(session, null, 2));
// ...
}Or check NextAuth debug mode:
NEXTAUTH_DEBUG=true