From 778180a5dc984ec1b21bb6922be566ff82833987 Mon Sep 17 00:00:00 2001 From: MythEclipse Date: Wed, 17 Jun 2026 14:14:13 +0700 Subject: [PATCH] fix: inline test-api.html as TypeScript string export for Vercel MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bun import of .html files returns HTMLBundle (not a string) in Vercel's serverless environment, and Bun.file() has no filesystem access there. Copy the HTML content into api/test-api-content.ts as an escaped string export, then import it in api/relay.ts — Bun bundler inlines it. Co-Authored-By: Claude --- api/relay.ts | 5 +---- api/test-api-content.ts | 1 + 2 files changed, 2 insertions(+), 4 deletions(-) create mode 100644 api/test-api-content.ts diff --git a/api/relay.ts b/api/relay.ts index dd6eee6..979d4a0 100644 --- a/api/relay.ts +++ b/api/relay.ts @@ -29,10 +29,7 @@ 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"; - -// 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(); +import testApiHtmlRaw from "./test-api-content"; // ─── Configuration ────────────────────────────────────────────────────────────── diff --git a/api/test-api-content.ts b/api/test-api-content.ts new file mode 100644 index 0000000..f8acb33 --- /dev/null +++ b/api/test-api-content.ts @@ -0,0 +1 @@ +export default "\n\n\n \n \n Edge Proxy — API Test\n \n\n\n
\n

Edge Proxy Relay — API Test

\n

Test all proxy endpoints from the browser

\n\n \n
\n
\n AUTH API Key\n \n
\n
\n \n
\n \n \n
\n
\n
\n\n \n
\n
\n GET /health\n \n
\n
\n \n
\n
\n
\n\n \n
\n
\n GET /v1/models\n \n
\n
\n \n
\n
\n
\n\n \n
\n
\n POST /v1/chat/completions\n \n
\n
\n \n \n \n \n \n
\n
\n
\n
\n\n \n
\n
\n POST /v1/messages (Anthropic)\n \n
\n
\n \n \n \n \n \n \n \n
\n
\n
\n
\n\n \n
\n
\n RELAY Generic HTTP Relay\n \n
\n
\n \n \n \n \n \n \n \n \n
\n
\n
\n
\n\n
\n
\n\n\n\n\n";