Download src/app/api/offcloud/debug/route.ts from Zero124/VR-MEDIA: direct link, hf CLI and curl.
- Browser
- Download file 914 Bytes
-
https://huggingface.co/spaces/Zero124/VR-MEDIA/resolve/main/src/app/api/offcloud/debug/route.ts
- Command line
-
hf download hf://spaces/Zero124/VR-MEDIA/src/app/api/offcloud/debug/route.ts
-
curl -L -o route.ts https://huggingface.co/spaces/Zero124/VR-MEDIA/resolve/main/src/app/api/offcloud/debug/route.ts
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(), | |
| }); | |
| } | |