You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Bug: Empty proxy response bodies turn HTTP 204, 205, and 304 into 500 #5699
Returning { statusCode: 204, body: '' } from an HTTP route should produce a 204 response with no body. The same should hold for status 205 and 304.
Current Behavior
The router returns 500 instead. handlerResultToWebResponse passes the empty string to the Web Response constructor, which rejects a non-null body for these statuses. The router catches that error and returns an internal-server-error response.
Confirmed on current main at 3919a3ce3af3ff9fc10d8f6332260cef063822ec through Router.resolve(): all nine combinations of statuses 204/205/304 and REST API v1/HTTP API v2/ALB return 500.
The nine corresponding controls with body omitted pass, as do three controls returning { statusCode: 200, body: '' }. The existing routing test file, with these regressions added, reports 9 failed and 212 passed.
Invoke it with a REST API v1, HTTP API v2, or ALB GET /empty event.
Observe status 500 instead of 204.
Repeat with status 205 or 304; both also return 500.
Remove body: ''; the requested status is returned correctly.
Possible Solution
Normalize an empty proxy-result body to null before constructing a Web Response for statuses that prohibit a body. Add regression coverage through Router.resolve() for 204, 205, and 304 across all three integrations.
Workaround: omit the body property.
Powertools for AWS Lambda (TypeScript) version
2.35.0 in the source checkout at 3919a3ce3af3ff9fc10d8f6332260cef063822ec.
AWS Lambda function runtime
24.x — reproduced locally on Node.js v24.19.0; no Lambda deployment was used.
Packaging format used
npm
Execution logs
The regression assertions fail with:
AssertionError: expected 500 to be 204
AssertionError: expected 500 to be 205
AssertionError: expected 500 to be 304
Tests: 9 failed | 212 passed (221)
This issue is now closed. Please be mindful that future comments are hard for our team to see.
If you need more assistance, please either reopen the issue, or open a new issue referencing this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.
Activity
powertools-for-aws-oss-automation commentedon Sep 13, 2026
Warning
This issue is now closed. Please be mindful that future comments are hard for our team to see.
If you need more assistance, please either reopen the issue, or open a new issue referencing this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.