import { NextResponse } from "next/server"; import { getSessionUser } from "@/lib/server/session"; import { getRequestMeta } from "@/lib/server/request"; import { toErrorResponse } from "@/lib/server/errors"; export async function GET() { const { requestId } = await getRequestMeta(); try { const user = await getSessionUser(); if (!user) return NextResponse.json({ requestId, request_id: requestId, error: { code: "UNAUTHORIZED", message: "Unauthorized" } }, { status: 401 }); return NextResponse.json({ requestId, request_id: requestId, user }); } catch (e) { const { status, body } = toErrorResponse(e, "GET /api/auth/me", requestId); return NextResponse.json(body, { status }); } }