Closed
Description
Suppose one has two routes to delete resources like the following:
Use Case 1:
Route in handler
@app.delete("/accounts/<account_id>")
def delete_account(account_id: str) -> None:
Request
{
"path": "/accounts/123",
"httpMethod": "DELETE",
"requestContext": {"requestId": "c6af9ac6-7b61-11e6-9a41-93e8deadbeef"}, # correlation ID
}
Use Case 2:
@app.delete("/accounts/<account_id>/source_networks")
def delete_source_networks(account_id: str) -> Account:
Request
{
"path": "/accounts/123/source_networks"
"httpMethod": "DELETE",
"requestContext": {"requestId": "c6af9ac6-7b61-11e6-9a41-93e8deadbeef"}, # correlation ID
}
Expected Behavior
Expected behavior is that account_id equals 123 in both use cases
Current Behavior
For use case 1 resolver calls the right function and sets account_id = 123
For use case 2, resolver calls the function of use case 1 and sets accound_id = 123/source_networks
Possible Solution
Not sure if this is actually the expected behavior of proxy integration with its greedy regexp or a bug in Lambda Power Tools
Environment
Power Tools version 1.17.1
delete_source_networks_event = {'body': '{"networks": ["172.217.0.0/16", "8.8.8.8"]}', 'httpMethod': 'DELETE', 'path': **'/accounts/123/source_networks'**, ...}
{"level":"INFO","location":"delete:209","message":"Account deleted","timestamp":"2021-07-11 15:12:42,205-0300","service":"admin_api","cold_start":false,"function_name":"FUNCTION_NAME","function_memory_size":1024,"function_arn":"INVOKED_FUNCTION_ARN","function_request_id":"AWS_REQUEST_ID","correlation_id":"c6af9ac6-7b61-11e6-9a41-93e8deadbeef",**"account_id":"123/source_networks"**,"tax_id":"123","service_id":3}