Repository navigation
Commit fb0e8a2
committed
fix(event_handler): clear context when route resolution raises
resolve() and resolve_async() only cleared the routing context after a
response was built, so an exception escaping a route handler left the
previous invocation's context in place, including the cached Request.
A warm Lambda container could then hand that stale Request to the next
invocation.
Clear the context in a finally block instead. The ALB response size
validation no longer needs its own clean-up on error, and the JWT
middleware test now expects the whole context to be gone after a
failing handler rather than only the claims.1 parent 5b74209 commit fb0e8a2
5 files changed
Lines changed: 68 additions & 20 deletions
File tree
- aws_lambda_powertools/event_handler
- tests/functional
- auth_alpha/jwt/integrations
- event_handler/required_dependencies
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2560 | 2560 | | |
2561 | 2561 | | |
2562 | 2562 | | |
2563 | | - | |
| 2563 | + | |
| 2564 | + | |
| 2565 | + | |
| 2566 | + | |
2564 | 2567 | | |
2565 | 2568 | | |
2566 | 2569 | | |
| |||
2569 | 2572 | | |
2570 | 2573 | | |
2571 | 2574 | | |
2572 | | - | |
2573 | | - | |
2574 | 2575 | | |
2575 | 2576 | | |
2576 | 2577 | | |
| |||
2621 | 2622 | | |
2622 | 2623 | | |
2623 | 2624 | | |
2624 | | - | |
| 2625 | + | |
| 2626 | + | |
| 2627 | + | |
| 2628 | + | |
2625 | 2629 | | |
2626 | 2630 | | |
2627 | 2631 | | |
2628 | 2632 | | |
2629 | 2633 | | |
2630 | 2634 | | |
2631 | 2635 | | |
2632 | | - | |
2633 | | - | |
2634 | 2636 | | |
2635 | 2637 | | |
2636 | 2638 | | |
| |||
3401 | 3403 | | |
3402 | 3404 | | |
3403 | 3405 | | |
3404 | | - | |
3405 | | - | |
3406 | | - | |
3407 | | - | |
3408 | | - | |
3409 | | - | |
3410 | | - | |
3411 | | - | |
3412 | | - | |
3413 | | - | |
3414 | | - | |
3415 | | - | |
| 3406 | + | |
| 3407 | + | |
| 3408 | + | |
3416 | 3409 | | |
3417 | 3410 | | |
| 3411 | + | |
| 3412 | + | |
| 3413 | + | |
| 3414 | + | |
| 3415 | + | |
3418 | 3416 | | |
3419 | 3417 | | |
3420 | 3418 | | |
| |||
Lines changed: 1 addition & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
87 | | - | |
88 | | - | |
| 87 | + | |
89 | 88 | | |
90 | 89 | | |
91 | 90 | | |
| |||
Lines changed: 17 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1892 | 1892 | | |
1893 | 1893 | | |
1894 | 1894 | | |
| 1895 | + | |
| 1896 | + | |
| 1897 | + | |
| 1898 | + | |
| 1899 | + | |
| 1900 | + | |
| 1901 | + | |
| 1902 | + | |
| 1903 | + | |
| 1904 | + | |
| 1905 | + | |
| 1906 | + | |
| 1907 | + | |
| 1908 | + | |
| 1909 | + | |
| 1910 | + | |
| 1911 | + | |
1895 | 1912 | | |
1896 | 1913 | | |
1897 | 1914 | | |
| |||
Lines changed: 18 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
321 | 321 | | |
322 | 322 | | |
323 | 323 | | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
324 | 342 | | |
325 | 343 | | |
326 | 344 | | |
| |||
Lines changed: 16 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
456 | 456 | | |
457 | 457 | | |
458 | 458 | | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
459 | 475 | | |
460 | 476 | | |
461 | 477 | | |
| |||
0 commit comments