Back to news
cloud Priority 4/5 8/11/2026, 11:05:15 AM

Vercel Functions Now Support Bun.serve Entrypoints and Native WebSocket Handlers

Vercel Functions Now Support Bun.serve Entrypoints and Native WebSocket Handlers

Vercel has introduced native support for Bun.serve as an entrypoint for Vercel Functions utilizing the Bun runtime. This update enables developers to deploy server logic directly from a root-level server.ts file, maintaining consistency between local development and production environments without the need for additional web framework wrappers. With this integration, developers can map static, dynamic, and wildcard routes natively. The feature also enables native WebSocket support on Vercel Functions by allowing developers to initiate connection upgrades using the server.upgrade method directly within the fetch handler, resolving previous limitations on real-time event handling. Adopting this feature requires specifying bunVersion as 1.x or higher in the vercel.json configuration file and applying the Bun framework preset. When migrating existing functions, codebases must be adjusted to align routing structures and entrypoint filenames with the Bun.serve specifications.

Related tools

Recommended tools for this topic

These picks prioritize high-intent tools relevant to this topic. Some links may include partner or affiliate tracking.

#vercel#bun#typescript#websocket

Comparison

AspectBefore / AlternativeAfter / This
Entrypoint ConfigurationRequired framework adapters or wrapper configurations to route requestsDirect deployment of native server.ts using Bun.serve()
WebSocket ImplementationRestricted or required external workarounds to handle persistent connectionsNative support via server.upgrade inside the fetch handler
Routing ManagementManaged through framework-specific routing rules or Vercel JSON routingMapped natively via Bun's path and wildcard handling in server.ts

Action Checklist

  1. Configure vercel.json to target bunVersion 1.x or higher Ensure your project configuration explicitly defines a compatible Bun runtime version.
  2. Set up a server.ts file at the root of your project Define the export default Bun.serve block including fetch and optional websocket handlers.
  3. Enable the Bun framework preset in your Vercel project settings This preset allows Vercel to automatically detect and build the Bun.serve entrypoint.

Source: Vercel Changelog

This page summarizes the original source. Check the source for full details.

Related