generated from amazon-archives/__template_MIT-0
-
Notifications
You must be signed in to change notification settings - Fork 468
Open
Labels
bugSomething isn't workingSomething isn't workingtriagePending triage from maintainersPending triage from maintainers
Description
Expected Behaviour
Allowing route with a resource /{proxy+} should not produce this error:
Invalid resource path: /{proxy+}. Path should match ^[/.a-zA-Z0-9-_\\*]+$
policy.allow_route(http_method="GET", resource="/{proxy+}")
# No error raisedCurrent Behaviour
Currently a ValueError is raised when passing "/{proxy+}" at
Code snippet
@event_source(data_class=APIGatewayAuthorizerRequestEvent)
def lambda_handler(event: APIGatewayAuthorizerRequestEvent, _context: LambdaContext) -> dict[str, Any]:
arn = event.method_arn
policy = APIGatewayAuthorizerResponse.from_route_arn(
arn=arn,
principal_id="user",
)
# with event.resource = "/{proxy+}"
policy.allow_route(http_method=event.http_method, resource=event.resource)
return policy.asdict()Possible Solution
Modify the regex pattern affected to path_regex inside APIGatewayAuthorizerResponse class definition to accept the value /{proxy+}.
It can be passed to r"^([/.a-zA-Z0-9-_\*]+)|(\{proxy\+\})$" as example.
Steps to Reproduce
No special installation steps are required. I can reproduce the error with the latest release (3.24.0)
Powertools for AWS Lambda (Python) version
latest
AWS Lambda function runtime
3.13
Packaging format used
PyPi
Debugging logs
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingtriagePending triage from maintainersPending triage from maintainers
Type
Projects
Status
Triage