diff --git a/api/relay.ts b/api/relay.ts index 3490b3b..dd6eee6 100644 --- a/api/relay.ts +++ b/api/relay.ts @@ -29,7 +29,10 @@ import { createRateLimiter } from "../src/middleware/rate-limiter"; import { logRelayEvent } from "../src/middleware/logger"; import { handleChatCompletion, listModels } from "../src/lib/ai-proxy"; import { handleAnthropicMessages } from "../src/lib/anthropic-proxy"; -import testApiHtml from "../public/test-api.html" with { type: "text" }; + +// Read test-api.html at module scope so Bun's bundler inlines the content +// at build time (Vercel serverless has no filesystem at runtime). +const testApiHtmlRaw = await Bun.file("public/test-api.html").text(); // ─── Configuration ────────────────────────────────────────────────────────────── @@ -382,7 +385,7 @@ export default { // Static routes — show index only when no relay target is requested if (url.pathname === "/health") return handleHealth(); if (url.pathname === "/docs" || url.pathname === "/test") { - return new Response(testApiHtml, { + return new Response(testApiHtmlRaw, { headers: { "Content-Type": "text/html; charset=utf-8" }, }); }