Warning: Edge Functions are currently in Beta . The API might change as we look to continually make improvements.

There are two ways to serve content: statically or dynamically.

Static content is served from a Content Delivery Network (CDN) close to the user, allowing for fast response times as the CDN caches it. This caching means the same content is delivered to all visitors, no matter where they are in the world. However, this approach may not be viable if you want to deliver personalized content.

With dynamic content, you can take advantage of server-side rendering to give your user a personalized experience on each request. This means you can show different content based on the visitor's location. However, this approach can be slower if the server rendering the page is far away from the visitor requesting it.

What are Edge Functions?

Edge Functions allow you to deliver content to your site's visitors with speed and personalization. They are deployed globally by default on Vercel's Edge Network, have zero cold starts, and enable you to move server-side logic to the Edge, close to your visitor's origin.


A visitor lives in Tokyo and makes a request to access your site. Before they can see the page, you want to check they are authenticated.

Traditionally, servers are hosted in a single region (often us-east), which means your request from Tokyo needed to travel around the world to check if the user is authenticated.

To solve this, you can use Edge Middleware to deploy your authentication logic to every Edge, placing the code close to your visitor and decreasing the roundtrip latency of the request. This means that your site's visitor can get their personalized content with minimal delay.

Known limitations

Edge Functions include some limitations that you should be aware of:

  • The maximum size for an Edge Function is 1 MB, including all the code that is bundled in the function. For more information, see the Limitations guide.
  • Native Node.js APIs are not supported. For more information on all API limitations, see Unsupported APIs and Runtime restrictions.

Using Edge Functions

To learn how to use Edge Functions, see the Edge Functions Quickstart guide.

Currently, Edge Functions have framework integration with Next.js and SvelteKit. However, you can use the Build Output API to use Edge Functions with any tool of your choice.


Middleware is code that executes before a request is processed. Depending on the incoming request, you can execute custom logic, rewrite, redirect, add headers and more, before returning a response.

The Middleware API is based upon the native FetchEvent, Response, and Request objects, which are extended to give you more control over how you manipulate and configure a response, based on the incoming requests.

When using Vercel, Middleware are deployed globally as Edge Functions close to your visitors.


Edge Functions have full support for the console API, incluing time, debug, timeEnd, etc. Logs will appear inside your Vercel project under the Functions tab.

Edge Functions Logs view.