Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Bug: QueryString Parameters are not coming thru #6896

Open
@94Sip

Description

@94Sip

Expected Behaviour

I expect to be able to route to the appropriate method and the handling of querystrings to be available to me, depending on how I choose to do Validation, or not.

Current Behaviour

I've tried multiple ways to parse and handle querystring parameters, and neither is working.
The path of /rut/calendar will work (route), regardless of the below methods.
The path of /rut/calendar?yr=2023&mo=11 always fails and gets handled by the not found exception handler, regardless of the below methods

In the code snippet are the 2 separate ways I have tried.

Code snippet

app = APIGatewayRestResolver(cors=cors_config, enable_validation=False)

@app.get("/rut/calendar")
@tracer.capture_method
def get_rut_calendar():
   """Get rut calendar for specific year/month"""
   logger.info("Rut calendar requested")

#---------------------------- using Validation --------------------------------
app = APIGatewayRestResolver(cors=cors_config, enable_validation=True)

@app.get("/rut/calendar")
@tracer.capture_method
def get_rut_calendar(yr: Optional[int] = None, mo: Optional[int] = None):
   """Get rut calendar for specific year/month"""
   logger.info("Rut calendar requested")

Possible Solution

Obviously I think there is a bug with EnableValidation, but the documentation seems to be lacking clarity between the Validation of QueryStrings and the subsequent section on handling querystrings.

Steps to Reproduce

Call the 2 methods with the path I have provided, one with querystrings, and one without

Powertools for AWS Lambda (Python) version

latest

AWS Lambda function runtime

3.12

Packaging format used

Lambda Layers

Debugging logs

Here is the result from CloudWatch:
{
"level": "INFO",
"location": "handle_not_found_errors:333",
"message": "Not found route: /rut/calendar?yr=2023&mo=11",
"timestamp": "2025-06-30 13:02:48,993+0000",
"service": "rut-predictor-api",
"cold_start": true,
"function_name": "TexasRutPredictorProxy",
"function_memory_size": "1024",
"function_arn": "arn:aws:lambda:us-east-2:206693260617:function:TexasRutPredictorProxy",
"function_request_id": "7fcbddf5-f9bb-4d46-9f0b-ad2ef64260e8",
"xray_trace_id": "1-68628adf-01b87d1d2fef9f6b73865206"
}

Metadata

Metadata

Labels

need-customer-feedbackRequires more customers feedback before making or revisiting a decision

Type

No type

Projects

Status

Pending customer

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions