Skip to content

feat(aws_lambda): add aws_request_id and log_stream_name to the request context - #1624

Merged
mwbrooks merged 3 commits into
slackapi:mainfrom
kushaldave002:feat/lambda-context-request-id
Nov 17, 2026
Merged

mwbrooks merged 3 commits into
slackapi:mainfrom
kushaldave002:feat/lambda-context-request-id

Conversation

@kushaldave002

Copy link
Copy Markdown
Contributor

Summary

Adds aws_request_id and log_stream_name from the AWS Lambda context object to BoltRequest.context in SlackRequestHandler, next to the existing aws_lambda_function_name and aws_lambda_invoked_function_arn. This makes them available to listeners and middleware for correlating logs with the Lambda invocation.

Fixes #1035

Testing

  • New test test_lambda_context_in_bolt_context in tests/adapter_tests/aws/test_aws_lambda.py sends a signed event through the handler and checks both values reach the Bolt context. It fails without the handler change.
  • Ran ./scripts/format.sh --no-install, ./scripts/lint.sh --no-install, ./scripts/run_mypy.sh --no-install (all pass) and pytest tests/adapter_tests/aws (22 passed).

Category

  • slack_bolt.App and/or its core components
  • slack_bolt.async_app.AsyncApp and/or its core components
  • Adapters in slack_bolt.adapter
  • Document pages under /docs
  • Others

Requirements

  • I've read and understood the Contributing Guidelines and have done my best effort to follow them.
  • I've read and agree to the Code of Conduct.
  • I've run ./scripts/install_all_and_run_tests.sh after making the changes.

@kushaldave002
kushaldave002 requested a review from a team as a code owner November 14, 2026 02:56
@salesforce-cla

Copy link
Copy Markdown

Thanks for the contribution! Before we can merge this, we need @kushaldave002 to sign the Salesforce Inc. Contributor License Agreement.

@zimeg zimeg added enhancement New feature or request area:adapter semver:minor python Pull requests that update Python code labels Nov 14, 2026
@zimeg zimeg added this to the next milestone Nov 14, 2026
@mwbrooks

Copy link
Copy Markdown
Member

@kushaldave002 Could you sign the Salesforce CLA? We need it signed before we can continue with this PR. 🙏

@mwbrooks mwbrooks left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Thanks @kushaldave002 for this and for the test! 🎉 Congrats on your first contribution to bolt-python!

Comment on lines +60 to +61
bolt_req.context["aws_request_id"] = context.aws_request_id
bolt_req.context["log_stream_name"] = context.log_stream_name

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (non-blocking): The two keys above use an aws_lambda_ prefix, so could we match it here? It keeps them grouped for anyone reading context.

Suggested change
bolt_req.context["aws_request_id"] = context.aws_request_id
bolt_req.context["log_stream_name"] = context.log_stream_name
bolt_req.context["aws_lambda_request_id"] = context.aws_request_id
bolt_req.context["aws_lambda_log_stream_name"] = context.log_stream_name

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renamed in commit 202ddf0, so this is ready to go! 🙏

@codecov

codecov Bot commented Nov 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.57%. Comparing base (f5f9ad7) to head (f7e9d86).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1624   +/-   ##
=======================================
  Coverage   91.57%   91.57%           
=======================================
  Files         228      228           
  Lines        7285     7287    +2     
=======================================
+ Hits         6671     6673    +2     
  Misses        614      614           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

@mwbrooks mwbrooks left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Thanks @kushaldave002! This will make it much easier to match Bolt logs to a Lambda invocation. 🚀

@mwbrooks
mwbrooks merged commit 138cf85 into slackapi:main Nov 17, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:adapter cla:signed enhancement New feature or request python Pull requests that update Python code semver:minor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AWS Lambda Adapter: Expose aws_request_id and log_stream_name in SlackRequestHandler context

3 participants