---
title: "502 Bad Gateway in Netlify"
canonical: "https://lemwatch.com/http-status-codes/502/in-netlify"
platform: "Netlify"
last_verified: "2026-08-11"
source: "https://lemwatch.com"
---

# HTTP 502 Bad Gateway in Netlify

**Platform** — Netlify — Jamstack hosting with edge functions.

**Where it surfaces** — Netlify's function logs, deploy summary, or the browser DevTools network tab.

## Cause on this platform

Function cold-start exceeded 10s or returned an invalid Lambda response.

## Fix on this platform

Return a well-formed `{ statusCode, body }` object and reduce cold-start weight (fewer top-level imports).


## Generic reference

A server acting as a gateway or proxy received an invalid response from the upstream server — common with Nginx, Cloudflare, and load balancers.

_Canonical HTML page: https://lemwatch.com/http-status-codes/502/in-netlify_
