HTTP 502 Bad Gateway in Netlify
Netlify — Jamstack hosting with edge functions.
What triggers it in Netlify
Function cold-start exceeded 10s or returned an invalid Lambda response.
How to fix it on Netlify
Return a well-formed `{ statusCode, body }` object and reduce cold-start weight (fewer top-level imports).
Where you'll see it
Netlify's function logs, deploy summary, or the browser DevTools network tab.
Monitor 502 responses continuously
Lemwatch checks your Netlify endpoints as often as every 5 minutes and alerts the moment a 502 pattern appears — with the full response headers and body captured, so you can debug without waiting for the next customer report.
Same error on other platforms
502 Bad Gateway in Netlify — FAQs
Function cold-start exceeded 10s or returned an invalid Lambda response.
Return a well-formed `{ statusCode, body }` object and reduce cold-start weight (fewer top-level imports).
502 on Netlify is usually transient — it clears once the underlying resource (function, upstream API, or cache node) recovers. If it persists more than 5 minutes across regions, treat it as a real incident and check Netlify's function logs, deploy summary, or the browser DevTools network tab..
Persistent 502s cause the same deindexing risk as 500s, often worse because 502 frequently affects an entire site at once (when the origin is down, every page is down). CDN-level 502s during a Googlebot crawl can cause Google to throttle the entire site's crawl rate. A repeated pattern of 502s also lowers Google's confidence in your hosting stack, which affects ranking stability over months. On Netlify specifically, Googlebot sees the same 502 your users see, so unresolved errors get reflected in Search Console's Page indexing report within days.
Set up an HTTP monitor that pings your key Netlify endpoints from multiple regions every 1–5 minutes and alerts on any non-2xx response. Lemwatch does this out of the box — including capturing the full response headers and body when a 502 hits, so you can debug without waiting for the next user report.
Both are server error responses, but they mean different things: 502 Bad Gateway indicates a server acting as a gateway or proxy received an invalid response from the upstream server — common with nginx, cloudflare, and load balancers., while 500 is a distinct condition with its own root cause. On Netlify, the fix path and the log signature are different — check the exact status code your Netlify logs return before applying a fix.