VR-MEDIA / src /app /api /offcloud /debug /route.ts
Zero124's picture
VR Media Server 2.0 — latest build (custom Blomp thumbnail auto-detection + full pipeline)
5c0175e
Raw History Blame Contribute Delete
914 Bytes
// GET /api/offcloud/debug — diagnostic endpoint to verify API key is being read.
// Returns the key detection status without exposing the key itself.
// Use this to troubleshoot "stuck in mock mode" issues.
import { NextResponse } from "next/server";
import { getApiKey, testConnection } from "@/lib/offcloud";
export const dynamic = "force-dynamic";
export async function GET() {
const key = await getApiKey();
const keySource = process.env.OFFCLOUD_API_KEY && process.env.OFFCLOUD_API_KEY.trim()
? "env_var (HF Space Secret)"
: key
? "settings_table (set via UI)"
: "none";
const conn = await testConnection();
return NextResponse.json({
keyDetected: !!key,
keyLength: key?.length ?? 0,
keyPrefix: key ? `${key.slice(0, 4)}...${key.slice(-4)}` : null,
keySource,
connection: conn,
timestamp: new Date().toISOString(),
});
}