---
title: Detect memory and OOM failures in Vercel Functions
description: Fix out-of-memory (OOM) errors and memory limit exceeded crashes in Vercel serverless functions. Debug 5xx errors, monitor function memory usage, and prevent OOM failures before they impact production.
url: /kb/guide/detect-memory-and-oom-failures-in-serverless-functions
canonical_url: "https://vercel.com/kb/guide/detect-memory-and-oom-failures-in-serverless-functions"
last_updated: 2026-06-02
authors: Vercel
related:
  - /docs/functions
  - /docs/instant-rollback
  - /docs/functions/configuring-functions/memory
  - /docs/alerts
install_vercel_plugin: npx plugins add vercel/vercel-plugin
---

## Overview

When a [Vercel Function](https://vercel.com/docs/functions) runs out of memory, it exits with an error and returns a 5xx response to the caller. Vercel's anomaly detection picks this up without any configuration required. The moment a memory-related failure causes a spike in errors on a route, Vercel triggers an alert, runs an AI investigation to identify the root cause, and sends you a notification.

This guide explains how OOM failures surface in Vercel Alerts, how to monitor memory usage proactively before functions start failing, and how to use Alert Rules to route critical function errors to the right channel.

## How OOM failures surface in alerts

When a function hits its memory limit, the runtime terminates it and returns a 500 error. If enough requests fail in a short window, Vercel detects the 5xx spike and triggers an alert.

The AI investigation identifies the pattern and generates a plain-language title describing the root cause such as "Memory limit exceeded on `/api/chat`" or "5xx spike from function crashes on `/api/process`". You'll receive this summary in your email or Slack notification without having to dig through logs.

Alerts resolve automatically once error rates return to baseline e.g. after you [roll back the deployment](https://vercel.com/docs/instant-rollback) or increase the [function's memory limit](https://vercel.com/docs/functions/configuring-functions/memory).

## Monitor memory usage before functions fail

Vercel exposes memory metrics for your functions in the Observability dashboard. You can use these to spot functions approaching their limit before they start returning errors.

1. Go to [Observability Functions](https://vercel.com/d?to=%2F%5Bteam%5D%2F%5Bproject%5D%2Fobservability%2Fvercel-functions&title=Go+to+Observability+Functions) in your project.
   
2. Select the route you want to inspect.
   
3. Review the **Peak memory** chart (p99) alongside the provisioned memory limit.
   

A function consistently using 80–90% of its provisioned memory is at risk of OOM failures under traffic spikes or with larger payloads. To increase a function's memory limit, set the `memory` option in your `vercel.json`:

`{ "functions": { "api/process.ts": { "memory": 3009 } } }`

The default memory limit is 1024 MB. The maximum is 3009 MB on Pro and Enterprise plans.

## Route critical function alerts to your team

By default, Vercel sends all alert notifications by email. To make sure memory-related failures reach the right people immediately, you can create an Alert Rule that routes critical alerts to a dedicated Slack channel or webhook.

See [Filter to critical alerts only](https://vercel.com/docs/alerts) to learn how to set up Alert Rules.

## Next steps

- [View function memory metrics](https://vercel.com/d?to=%2F%5Bteam%5D%2F%5Bproject%5D%2Fobservability%2Fvercel-functions&title=Go+to+Observability+Functions) in **Observability** → **Functions**.
  
- [Configure memory limits](https://vercel.com/docs/functions/configuring-functions/memory) for individual functions in `vercel.json`.
  
- [Set up Alert Rules](https://vercel.com/docs/alerts?__vercel_draft=1#configure-alerts-with-alert-rules) to route critical alerts to Slack or a webhook.