Repository navigation
Commit dbe1662
fix(event_handler): clear Bedrock Agent function context when a tool raises (#8874)
* fix(event_handler): clear Bedrock Agent function context when a tool raises
BedrockAgentFunctionResolver only cleared the context after a tool
returned. When the tool raised, the error response was built without
clearing it, so data added with append_context carried over to the next
invocation on the same warm container. An event missing a required
field had the same problem.
Clear the context in a finally block in resolve(), as ApiGatewayResolver
and AppSyncResolver already do.
* test(event_handler): pass a plain dict as context in the invalid event test
---------
Co-authored-by: Leandro Damascena <lcdama@amazon.pt>1 parent a1f97bd commit dbe1662
2 files changed
Lines changed: 46 additions & 2 deletions
File tree
- aws_lambda_powertools/event_handler
- tests/functional/event_handler/required_dependencies
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
192 | 192 | | |
193 | 193 | | |
194 | 194 | | |
| 195 | + | |
| 196 | + | |
195 | 197 | | |
196 | 198 | | |
197 | 199 | | |
| |||
235 | 237 | | |
236 | 238 | | |
237 | 239 | | |
238 | | - | |
239 | | - | |
240 | 240 | | |
241 | 241 | | |
242 | 242 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
350 | 350 | | |
351 | 351 | | |
352 | 352 | | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
353 | 397 | | |
354 | 398 | | |
355 | 399 | | |
| |||
0 commit comments