Problem: When visiting the Vercel-deployed site, the browser attempts to download a file (MPEG-2 transport stream) instead of displaying the website.
Root Cause: Vercel does not natively support Bun runtime. The initial deployment configuration was trying to run Bun code directly on Vercel's infrastructure, which caused incorrect MIME type detection and file serving behavior.
Attempted Solutions:
{
"buildCommand": "bun install",
"devCommand": "bun run dev",
"installCommand": "bun install"
}Result: ❌ Still downloading file
{
"functions": {
"api/**/*.ts": {
"runtime": "nodejs20.x"
}
}
}Result: ❌ Build error: "Function Runtimes must have a valid version"
{
"rewrites": [
{
"source": "/(.*)",
"destination": "/api"
}
]
}Result: ❌ Still downloading file
The application works perfectly locally with Bun but has compatibility issues with Vercel's serverless platform.
Hono has excellent support for Vercel Edge Runtime:
// api/index.ts
export const config = {
runtime: 'edge',
};
import app from '../index';
export default app.fetch;Create individual serverless functions for each route:
api/
index.ts -> handles /
time.ts -> handles /api/time
times.ts -> handles /api/times
Install and configure the official Vercel Node adapter:
npm install @vercel/nodeConsider alternative platforms that natively support Bun:
- Railway: Full Bun support
- Fly.io: Supports Bun via Docker
- Render: Supports Bun natively
- Cloudflare Workers: Hono works great here
Current Stack:
- Runtime: Bun (local development)
- Framework: Hono v4
- Entry Point:
index.ts - Serverless Adapter:
/api/index.ts(attempted)
Vercel Constraints:
- No native Bun support
- Requires Node.js or Edge runtime
- Serverless functions must export proper handlers
- TypeScript compilation happens during build
File Structure:
/
├── index.ts # Main Hono app
├── api/
│ └── index.ts # Vercel serverless entry point (attempted)
├── ui/
│ └── omniversify.ts # UI components
├── *.ts # Calendar data files
└── vercel.json # Vercel configuration
-
Try Edge Runtime (Fastest to implement):
- Update
/api/index.tsto use Edge runtime config - Export
app.fetchdirectly - This should work with Hono's design
- Update
-
If Edge Runtime fails, switch platforms:
- Railway deployment is straightforward with Bun
- Cloudflare Workers is another excellent option for Hono
-
Alternative: Convert to Node.js:
- Change
package.jsonto use Node.js - Update imports to use Node-compatible modules
- Lose Bun's performance benefits but gain Vercel compatibility
- Change
The content negotiation feature (HTML UI vs JSON) works perfectly locally. Need to ensure this continues working on whichever deployment platform is chosen.
- Converted Express to Hono
- Converted JSON data to TypeScript
- Implemented content negotiation
- Created UI components
- Local development working
- Vercel deployment working
- Production deployment verified
Last Updated: 2026-02-06
Status: Investigating Vercel deployment issues