caelum0x 0b7b78481f fix(console): mark /api/v1/me dynamic, add SCRIBASE_URL var
The route read env.SCRIBASE_URL at module load, which made Next try to
statically prerender it at build time with no Cloudflare bindings
available, failing the build. Matches the force-dynamic pattern already
used by every other authenticated route in this app.

First production deploy: railyard.ereboslab.com is live.
2026-10-14 14:43:46 +03:00

17 lines
733 B
TypeScript

import { deps } from "../../../../lib/deps.ts";
import { json } from "../../../../lib/http.ts";
import { access } from "../../../../lib/ladder.ts";
import { orgForBearer } from "../../../../lib/tokens.ts";
export const dynamic = "force-dynamic";
export async function GET(req: Request) {
const { repo } = deps();
const who = await orgForBearer(repo, req.headers.get("authorization"));
if (!who) return json({ error: "unauthorized" }, 401);
const org = await repo.getOrg(who.orgId);
const a = access(await repo.getEntitlement(who.orgId), new Date());
const apps = await repo.listApps(who.orgId);
return json({ org: { id: org?.id, name: org?.name }, access: a, apps: apps.map((x) => ({ id: x.id, name: x.name })) });
}