Title: Enable developers to inject non-bolt arguments to listener function args · Issue #709 · slackapi/bolt-python · GitHub
Open Graph Title: Enable developers to inject non-bolt arguments to listener function args · Issue #709 · slackapi/bolt-python
X Title: Enable developers to inject non-bolt arguments to listener function args · Issue #709 · slackapi/bolt-python
Description: I'm using dependency_injector to provide automatic dependency injection for my application, and I'm encountering an issue with Bolt overriding injected parameters with None since it doesn't recognize them. Reproducible in: pip freeze | g...
Open Graph Description: I'm using dependency_injector to provide automatic dependency injection for my application, and I'm encountering an issue with Bolt overriding injected parameters with None since it doesn't recogni...
X Description: I'm using dependency_injector to provide automatic dependency injection for my application, and I'm encountering an issue with Bolt overriding injected parameters with None since it doesn...
Opengraph URL: https://github.com/slackapi/bolt-python/issues/709
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Enable developers to inject non-bolt arguments to listener function args","articleBody":"I'm using [dependency_injector](https://python-dependency-injector.ets-labs.org) to provide automatic dependency injection for my application, and I'm encountering an issue with Bolt overriding injected parameters with `None` since it doesn't recognize them.\r\n\r\n### Reproducible in:\r\n\r\n```bash\r\npip freeze | grep slack\r\npython --version\r\nsw_vers && uname -v # or `ver`\r\n```\r\n\r\n#### The `slack_bolt` version\r\n\r\n```\r\nslack-bolt==1.14.3\r\nslack-sdk==3.18.1\r\n```\r\n\r\n#### Python runtime version\r\n\r\n```\r\nPython 3.10.6\r\n```\r\n\r\n#### OS info\r\n\r\n```\r\nProductName: macOS\r\nProductVersion: 12.5.1\r\nBuildVersion: 21G83\r\nDarwin Kernel Version 21.6.0: Wed Aug 10 14:28:23 PDT 2022; root:xnu-8020.141.5~2/RELEASE_ARM64_T6000\r\n```\r\n\r\n#### Steps to reproduce:\r\n\r\n(Share the commands to run, source code, and project settings (e.g., setup.py))\r\n\r\n1. Have a kwarg that is populated by some mechanism other than bolt (such as another decorator), e.g.\r\n\r\n```python\r\n@app.command('/ping')\r\n@inject\r\nasync def handle_ping(ack, respond, version: str = Provide[Container.config.VERSION]):\r\n await ack()\r\n await respond({\r\n \"blocks\": [\r\n SectionBlock(text=MarkdownTextObject(text='Pong!')),\r\n DividerBlock(),\r\n ContextBlock(elements=[\r\n MarkdownTextObject(text=f'*Host:* {platform.node()}'),\r\n MarkdownTextObject(text=f'*Version:* {version}')\r\n ])\r\n ]\r\n })\r\n```\r\n\r\n### Expected result:\r\n\r\nBolt doesn't touch the `version` kwarg, but still injects the `ack` and `respond` kwargs.\r\n\r\n### Actual result:\r\n\r\n`version` ends up being set to `None` and Bolt logs the following warning: `version is not a valid argument`.\r\n\r\nThis is caused by [this line](https://github.com/slackapi/bolt-python/blob/main/slack_bolt/kwargs_injection/async_utils.py#L105). \r\n\r\n## Requirements\r\n\r\nPlease read the [Contributing guidelines](https://github.com/slackapi/bolt-python/blob/main/.github/contributing.md) and [Code of Conduct](https://slackhq.github.io/code-of-conduct) before creating this issue or pull request. By submitting, you are agreeing to those rules.\r\n","author":{"url":"https://github.com/cooperbenson-qz","@type":"Person","name":"cooperbenson-qz"},"datePublished":"2022-08-24T16:56:33Z","url":"https://github.com/slackapi/bolt-python/issues/709"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:7c299d12-f10a-730b-3485-60a3327976ef |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8D7E:3CE0F6:1557B31:1C670DC:6AFEB907 |
| html-safe-nonce | d887a921439864d0e38990895d4dfb2ba947ed89dbac7f4c56e274412c5ea241 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4RDdFOjNDRTBGNjoxNTU3QjMxOjFDNjcwREM6NkFGRUI5MDciLCJ2aXNpdG9yX2lkIjoiNDQyMzgxOTYzMjM4OTgzMDkxOSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 75d9ccfdd4c34be4a7038949f83438d87d9646db0d637af96b98c2f45315ef7d |
| hovercard-subject-tag | issue:1349760483 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/slackapi/bolt-python/709/issue_layout |
| twitter:image | https://opengraph.githubassets.com/66e48b2c3771570c19adf92d7c66cb2464bd140e3f002f53469f940893ab6d00/slackapi/bolt-python/issues/709 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/66e48b2c3771570c19adf92d7c66cb2464bd140e3f002f53469f940893ab6d00/slackapi/bolt-python/issues/709 |
| og:image:alt | I'm using dependency_injector to provide automatic dependency injection for my application, and I'm encountering an issue with Bolt overriding injected parameters with None since it doesn't recogni... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | cooperbenson-qz |
| hostname | github.com |
| expected-hostname | github.com |
| None | 95b2753c978240785d6cca00783c00a371b2d7d9879bb32e305170a1b19bd28e |
| turbo-cache-control | no-preview |
| go-import | github.com/slackapi/bolt-python git https://github.com/slackapi/bolt-python.git |
| octolytics-dimension-user_id | 6962987 |
| octolytics-dimension-user_login | slackapi |
| octolytics-dimension-repository_id | 268795735 |
| octolytics-dimension-repository_nwo | slackapi/bolt-python |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 268795735 |
| octolytics-dimension-repository_network_root_nwo | slackapi/bolt-python |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 3f25273206cd841171bca0002261ae4c9757d934 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width