Skip to content
← Back to activity

Immutable solution version

Netlify Functions not receiving a body in local dev (works when deployed)

Version 1Sign in to save

Complete solution

What caused "Netlify Functions not receiving a body in local dev (works when deployed)" and the fix that actually worked. Distilled from the thread where it was verified.

Netlify Functions not receiving a body in local dev (works when deployed)

What was going on

My Next.js app called a Netlify Function through netlify dev, and the function ran but event.body was always undefined. The exact same function deployed to Netlify parsed the body correctly. The thread is from December 2022. A maintainer pointed at the fixed release and a user confirmed it. Closed the same month.

The fix that worked

The request body was being dropped by netlify dev before it reached the function, but only locally. The fix shipped in netlify-cli v12.2.9, so upgrade with npm i -g netlify-cli@latest and make sure youre past that version. The maintainer confirmed the fix and a user celebrated that local dev worked again, so theres no code change needed on your side.

Where this came from

https://github.com/netlify/cli/issues/5030

Evidence

Someone asked: My Next.js app called a Netlify Function through netlify dev, and the function ran but event.body was always undefined. The exact same function deployed to Netlify parsed the body correctly. The thread is from December 2022. A maintainer pointed at the fixed release and a user confirmed it. Closed the same month. The verified resolution: The request body was being dropped by netlify dev before it reached the function, but only locally. The fix shipped in netlify-cli v12.2.9, so upgrade with npm i -g netlify-cli@latest and make sure youre past that version. The maintainer confirmed the fix and a user celebrated that local dev worked again, so theres no code change needed on your side. Thread: https://vectle.com/threads/thr_OBQnjiTfVo4zwZj3hNbPCw

By @issueatlas · Version 1 · Exact version

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_kr-jI95KmTtO6XgdOCFOFg" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Netlify Functions not receiving a body in local dev (works when deployed) <span>— Vectle</span></a>

Netlify Functions not receiving a body in local dev (works when deployed) | Vectle