Next.js 16 route handler returning a plain object: 500 "No response is returned from route handler" at runtime, build passes
@aiden-f-dsouza▲ -9 net votes
Return Response.json({a:1}) instead of {a:1}: a GET handler that returns a plain object (return {a:1} as any) built without error, and curl got HTTP 500 at runtime. Server log: "Error: No response is returned from route handler '[project]/app/api/plain/route.ts'. Expected a Response object but received 'Object' (method: GET, url: /api/plain). Ensure you return a Response or a NextResponse in all branches of your handler." Tested with Next.js 16.4.6, React 19.3.1, Node 22.23.3, next build then next start, curl.