Title: Assistant listener middleware crashes when given a plain function · Issue #1597 · slackapi/bolt-python · GitHub
Open Graph Title: Assistant listener middleware crashes when given a plain function · Issue #1597 · slackapi/bolt-python
X Title: Assistant listener middleware crashes when given a plain function · Issue #1597 · slackapi/bolt-python
Description: Reproducible in: The slack_bolt version slack_bolt==1.30.0 slack_sdk==3.45.0 Python runtime version Python 3.12.5 OS info macOS 27.0 Steps to reproduce: Pass a plain function as listener middleware on an Assistant listener. from slack_bo...
Open Graph Description: Reproducible in: The slack_bolt version slack_bolt==1.30.0 slack_sdk==3.45.0 Python runtime version Python 3.12.5 OS info macOS 27.0 Steps to reproduce: Pass a plain function as listener middleware...
X Description: Reproducible in: The slack_bolt version slack_bolt==1.30.0 slack_sdk==3.45.0 Python runtime version Python 3.12.5 OS info macOS 27.0 Steps to reproduce: Pass a plain function as listener middleware...
Opengraph URL: https://github.com/slackapi/bolt-python/issues/1597
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Assistant listener middleware crashes when given a plain function","articleBody":"### Reproducible in:\n\n#### The `slack_bolt` version\n\n```\nslack_bolt==1.30.0\nslack_sdk==3.45.0\n```\n\n#### Python runtime version\n\n```\nPython 3.12.5\n```\n\n#### OS info\n\n```\nmacOS 27.0\n```\n\n#### Steps to reproduce:\n\nPass a plain function as listener middleware on an `Assistant` listener.\n\n```python\nfrom slack_bolt import App, Assistant\n\napp = App(token=\"xoxb-...\", signing_secret=\"secret\")\nassistant = Assistant()\n\ndef my_middleware(next):\n next()\n\n@assistant.user_message(middleware=[my_middleware])\ndef handle(say):\n say(\"hi\")\n\napp.use(assistant)\n```\n\n1. Register the listener above.\n2. Send a user message in an assistant thread.\n\n### Expected result:\n\nThe function is accepted as middleware, the same way `@app.event(..., middleware=[my_middleware])` accepts it.\n\n### Actual result:\n\nEvery matching event fails with `AttributeError: 'function' object has no attribute 'process'`.\n\n`Assistant.build_listener` in `slack_bolt/middleware/assistant/assistant.py` (and `AsyncAssistant` in `async_assistant.py`) treats every item in `middleware` as a `Middleware` instance. `App` wraps plain functions in `CustomMiddleware`, but the assistant does not. It also calls `middleware.insert(0, ...)` on the list the caller passed in, so the caller's list is changed.\n\nI have a fix with sync and async tests in #1591.\n\n## Requirements\n\nI have read the Contributing guidelines and Code of Conduct.\n","author":{"url":"https://github.com/sahiljagtap08","@type":"Person","name":"sahiljagtap08"},"datePublished":"2026-10-09T18:05:59Z","url":"https://github.com/slackapi/bolt-python/issues/1597"}
| 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:3014df3f-5f4e-6ab7-84af-b32a2fc1e7ae |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 96D4:38231F:99A5A9:D27325:6AFEBDAC |
| html-safe-nonce | 65442c1b94a653377a051112ea34383953b3d4940d1c1eb17e43ce7ca8a7170d |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5NkQ0OjM4MjMxRjo5OUE1QTk6RDI3MzI1OjZBRkVCREFDIiwidmlzaXRvcl9pZCI6Ijg3MzgxODc2MjIwODMzNzg2MDQiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | da1f1c42116052b4dbfdbae4555b46b6a05253c0039c7d1baa20bb811524badf |
| hovercard-subject-tag | issue:5782556126 |
| 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/1597/issue_layout |
| twitter:image | https://opengraph.githubassets.com/985a446bc81b8d3643ff081a9d3c79a321106e490ab09697ce2247997b65a1d5/slackapi/bolt-python/issues/1597 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/985a446bc81b8d3643ff081a9d3c79a321106e490ab09697ce2247997b65a1d5/slackapi/bolt-python/issues/1597 |
| og:image:alt | Reproducible in: The slack_bolt version slack_bolt==1.30.0 slack_sdk==3.45.0 Python runtime version Python 3.12.5 OS info macOS 27.0 Steps to reproduce: Pass a plain function as listener middleware... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | sahiljagtap08 |
| 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 | e1ce4c46d35aa8463a597a1bbffd4f0a456edb38 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width