aws-samples / aws-samples/sample-claude-code-web-agent-on-bedrock-agentcore
Bug: Streaming endpoint decorator on wrong function causing 422 errors
- Dominant language
- Python
- Stars
- 62
- Forks
- 18
- PR merge metrics
- No merged PRs in 30d
Description
Body:
## Description
The `/sessions/{id}/messages/stream` endpoint returns 422
validation errors because the `@router.post()` decorator is
incorrectly placed.
## Location
`backend/api/messages.py` lines 64-85
## Problem
The decorator is on `safe_json_dumps()` (line 65) instead of
`send_message_stream()` (line 85).
## Expected behavior
```python
@router.post("/sessions/{session_id}/messages/stream")
async def send_message_stream(session_id: str, request:
SendMessageRequest):
Actual behavior
@router.post("/sessions/{session_id}/messages/stream")
def safe_json_dumps(obj): # ← Wrong function!
Impact
- Streaming messages fail with 422 error
- Error: Field required: obj
Fix
Move decorator from line 64 to line 84 (before
send_message_stream)
Steps to reproduce
1. Create session
2. Send message via streaming endpoint
3. Get 422 validation error
Contributor guide
Assessment
This issue has not been assessed yet.