Edge Functions (Deprecated)
Remove export const runtime = 'edge' from your route files. Node.js is the default runtime, so no additional configuration is needed:
export async function GET() {
return Response.json({ message: 'Hello' });
}Vercel Functions with the Node.js runtime provide:
- Full Node.js API support, including file system access, native modules, and all npm packages.
- Fluid compute with automatic concurrency scaling.
- Streaming support.
- Global deployment with configurable regions.
See the Vercel Functions documentation for full details.
The following sections document the deprecated Edge Functions product for teams that are still migrating.
Edge Functions run on the Edge Runtime, a minimal JavaScript runtime based on V8 isolates. They execute in the region closest to the user by default, which can result in longer response times when the function depends on a database in a different region.
To reduce latency, you can limit your functions to regions near your database, or use a globally-distributed database. See Vercel storage options for guidance.
| Feature | Support status |
|---|---|
| Secure Compute | Not supported |
| Streaming | Supported |
| Cron jobs | Supported |
| Vercel Storage | Supported |
| Global Config | Supported |
| OTEL | Not supported |
| Feature | Edge Runtime |
|---|---|
| Maximum memory | 128 MB |
| Maximum duration | 25s to begin returning a response, then can continue streaming for up to 300s |
| Size (after gzip) | Hobby: 1 MB, Pro: 2 MB, Enterprise: 4 MB |
| Concurrency | Autoscaled based on your plan |
| Regions | Global by default, can specify a region |
| Name | Limit |
|---|---|
| Maximum URL length | 14 KB |
| Maximum request body length | 4 MB |
| Maximum number of request headers | 64 |
| Maximum request headers length | 16 KB |
- Maximum number of
fetchrequests per invocation: 950. - Maximum open connections: 6. Additional requests queue until in-flight requests complete.
- Connections idle for more than 15 seconds may be canceled. Use
catchon thefetchpromise orAbortControllerto handle timeouts.
Edge Functions use ES modules and don't have access to all Node.js or browser APIs. See the Edge Runtime supported APIs for the full list.
Dynamic code execution (eval, new Function(evalString), WebAssembly.instantiate) is not allowed for security reasons.
Routing Middleware can use no more than 50 ms of CPU time on average. This refers to net CPU time, not wall clock time. Time spent waiting for network responses doesn't count.
Edge Functions are included free within plan limits. Beyond included usage, Pro plans charge for additional consumption based on CPU time.
Functions using the Edge Runtime are measured in execution units, where each unit equals 50 ms of CPU time. CPU time doesn't include idle time spent waiting for data fetching.
| Resource | Hobby Included | Pro Included | Pro Additional |
|---|---|---|---|
| Edge Function Execution Units | First 500,000 | N/A | $2.00 per 1,000,000 Execution Units |
| Function Invocations | First 1,000,000 | N/A | $0.60 per 1,000,000 Invocations |
Vercel sends emails as you approach usage limits. On Hobby, you won't pay for additional usage, but your account may be paused if you exceed limits.
When your Hobby team is set to paused, it remains in this state indefinitely unless you take action. This means all new and existing deployments will be paused.
To unpause your account, you have two main options:
- Contact Support: You can reach out to our support team to discuss the reason for the pause and potential resolutions
- Transfer to a Pro team:
If your Hobby team is paused, you won't have the option to initiate a Pro trial. Instead, you can set up a Pro team:
- Create a Pro team account
- Add a valid credit card to this account. Open Settings in the sidebar, then select Billing and Payment Method
Once set up, a transfer modal will appear, prompting you to transfer your previous Hobby projects to this new team. After transferring, you can continue with your projects as usual.
Once your team exceeds included usage, you'll be charged on-demand costs.
Pro teams can set up Spend Management to get notified or to automatically take action, such as using a webhook or pausing your projects when your usage hits a set spend amount.
Enterprise agreements provide custom usage and pricing, including custom execution units and multi-region deployments. See Vercel Enterprise plans for details.
Check your usage in the Usage section of your dashboard. The Edge Functions section tracks:
| Metric | Description | Priced |
|---|---|---|
| Invocations | Number of times your functions were invoked. | Yes |
| Execution Units | Number of 50 ms CPU time units your Edge Functions used. | Yes |
| CPU Time | Total time your Edge Functions spent computing responses. | No |
- Reduce invocations: Cache responses using the CDN and Cache-Control headers.
- Reduce CPU time: Avoid heavy CPU-bound operations. View CPU time by project in the dashboard to identify optimization targets.
Was this helpful?