Suppress "WARNING: Invalid HTTP request received." warning

Open
#225 0 comments 1 reaction 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
45/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
python
Domain
backend

Research direction

Start with the runtime startup path and reproduce the warning using the lifespan example in 01-tutorials/01-AgentCore-runtime/01-hosting-agent/01-strands-with-bedrock-model/runtime_with_strands_and_bedrock_models.ipynb. Trace where "WARNING: Invalid HTTP request received." is emitted and verify that initialization no longer records this harmless message while application logs remain unaffected.

Written by the indexing model from the issue text.

Description

The following log may be recorded in the Application log output to CloudWatch Logs when the AgentCore runtime starts up.
When recorded during initialization after deployment, this is a message that does not affect the application. However, this could confuse users, so I would like to suppress it.

For example, you can confirm this log message by adding a lifespan to strands_claude.py as follows:

from contextlib import asynccontextmanager
from typing import AsyncGenerator

from strands import Agent, tool
from strands_tools import calculator # Import the calculator tool
import argparse
import json
from bedrock_agentcore.runtime import BedrockAgentCoreApp
from strands.models import BedrockModel

@asynccontextmanager
async def lifespan(_app: BedrockAgentCoreApp) -> AsyncGenerator[None, None]:
    """Completely empty lifespan context manager for testing."""
    yield
app = BedrockAgentCoreApp(lifespan=lifespan)

# Create a custom tool 
@tool
def weather():
    """ Get weather """ # Dummy implementation
    return "sunny"
(snip)
Dominant language
Python
Stars
786
Forks
163
Avg merge
4h
Merged PRs (30d)
22

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from aws/bedrock-agentcore-sdk-python

All issues in aws/bedrock-agentcore-sdk-python

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.