Next.js Route Handler: Body is unusable at second read request.json()
Endpoint returns Body is unusable or stream already read when trying to reread POST data. Request body stream can only be consumed once unless it has been cloned before.
How to determine the source of the error
Check whether middleware, debug login or validation perform request.text() before request.json().
Save the order of operations on the Request object in one endpoint call.
What to do step by step
1. Read request.json() exactly once and keep a sparred object for validation and business logic.
2 . If you need to preview raw content, use request.clone() with intent before consumption and limit the size of payload.
How to check the score
Endpoint takes the correct JSON, and malformed JSON returns controlled 400 instead of an exception.
What to do
Do not save all raw content of requests with customer data to public logs.