Netlify Function Timeout (502 / 504)

Share
Workaround available Web, CLI Updated November 13, 2026Based on 3 user reportsHow we research

Quick answer

Synchronous Netlify functions stop after 60 seconds and buffered responses max out at 6 MB. Move long work to a background function (15 minutes) or split it up.

Most likely fix: Use a background function

How to fix it

Try these in order — the most common fix is first.

  1. 1. Use a background function

    1. Name the file with the -background suffix; it runs up to 15 minutes but returns 202 immediately
    2. Store results in a database or blob store and poll
    Did this fix it?
  2. 2. Stream large responses

    1. Return a streamed response (up to 20 MB)
    Did this fix it?
  3. 3. Speed up the work

    1. Parallelize upstream calls, cache results, add timeouts to fetch
    Did this fix it?
  4. 4. Use a scheduled function for cron work

    1. Scheduled functions allow 30 seconds
    Did this fix it?
  5. 5. Raise memory/vCPU on Pro

    1. Set memory up to 4096 MB in config on credit-based Pro (cost scales)
    Did this fix it?
  6. 6. Check logs

    1. Open Logs > Functions to see the failing invocation
    Did this fix it?

Symptoms

Requests return 502/504 or 'Task timed out' after about a minute, or large responses fail.

Why it happens

  • Work exceeds the 60-second synchronous limit
  • Payload above 6 MB buffered / 4.5 MB binary
  • Slow upstream API
  • Cold start plus heavy work
  • Proxied requests time out after 26 seconds

This guide also covers

  • netlify function timeout
  • netlify function 502
  • netlify task timed out
  • netlify function 10 seconds

Still not working?

If Netlify keeps failing, you're not alone. See every Netlify problem users report or the alternatives people switch to.

Have an app idea? Our small team builds any software: web and mobile apps, games, desktop, AI tools. Price agreed together.

Talk to us
Fixed it? Share this guide

The same problem in other apps

All not loading, error messages & connection guides →

Other Netlify errors

All 10 Netlify errors and fixes →