Skip to content

Suppress "WARNING: Invalid HTTP request received." warning #225

@hiraken-w

Description

@hiraken-w

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions