-
Notifications
You must be signed in to change notification settings - Fork 421
Bug: equal sign in path breaks lambda dynamic URL paths #1736
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Thanks for opening your first issue here! We'll come back to you as soon as we can. |
@baraksalomon thank you for flagging it - I've just tested an exact route and works (API GW decodes the Creating a test and a fix shortly. Thanks! |
Done - triple tested with an endpoint deployed with the fix just in case. Waiting CI to complete and will kick off a patch release to unblock you and prevent others from failures. Endpoint - GET: https://p7bquief72.execute-api.eu-west-1.amazonaws.com/Prod/token/bXl0b2tlbg== Snippet from aws_lambda_powertools.event_handler import APIGatewayRestResolver
from aws_lambda_powertools.utilities.typing import LambdaContext
app = APIGatewayRestResolver()
@app.get("/token/<token>")
def get_token(token: str):
return {"received": f"{token}"}
def lambda_handler(event: dict, context: LambdaContext) -> dict:
return app.resolve(event, context) |
Wow, that was super fast. |
Fix available as 2.3.1 in PyPi - Compiling Lambda Layer and deploying the next version (15) across all regions. |
This is now released under 2.3.1 version! |
All complete now (PyPi+Layers+Docs) - let us know if this somehow doesn't fix it for you @baraksalomon. Thank you for the great bug report one more time ;) |
Expected Behaviour
When having an path like: /token/bXl0b2tlbg==
And a decorator like:
@app_rest.post("/token/")
def post_token(token: str):
..
The resolve should find this function and token parameter should be populated with "bXl0b2tlbg=="
Current Behaviour
When having an path like: /token/bXl0b2tlbg==
And a decorator like:
@app_rest.post("/token/")
def post_token(token: str):
..
The resolve returns 404.
Code snippet
Possible Solution
Didn't test it but maybe the equal sign is missing from:
SAFE_URI = "-.~()'!*:@,;" # https://www.ietf.org/rfc/rfc3986.txt
https://github.com/awslabs/aws-lambda-powertools-python/blob/118f3e995f35808cc3e4edbc70c33e6769e2506e/aws_lambda_powertools/event_handler/api_gateway.py#L43
Steps to Reproduce
Run the snipper code.
returns 404 instead of 200
AWS Lambda Powertools for Python version
latest
AWS Lambda function runtime
3.9
Packaging format used
PyPi
Debugging logs
No response
The text was updated successfully, but these errors were encountered: