Reproducible in:
The slack_bolt version
slack_bolt==1.30.0
slack_sdk==3.45.0
Python runtime version
OS info
Steps to reproduce:
Register a global error handler that takes args: Args.
from slack_bolt import App, Args
app = App(token="xoxb-...", signing_secret="secret")
@app.error
def on_error(error, args: Args):
args.logger.error(error)
@app.event("app_mention")
def boom(say):
raise RuntimeError("original error")
- Trigger the
app_mention event.
Expected result:
on_error runs and logs original error.
Actual result:
The error handler itself crashes before it runs:
TypeError: Args.__init__() missing 1 required positional argument: 'next'
The original RuntimeError is lost. In slack_bolt/kwargs_injection/utils.py (build_required_kwargs) and async_utils.py, next is removed from the available arguments for error handlers, but Args(**all_available_args) is then built from that reduced dict, and Args requires next. The same code also uses arg_names.pop() on the listener's own list, so the list shrinks on every call.
I have a fix with sync and async tests in #1592. It also adds an error field to Args so error handlers can read the exception through args.
Requirements
I have read the Contributing guidelines and Code of Conduct.
Reproducible in:
The
slack_boltversionPython runtime version
OS info
Steps to reproduce:
Register a global error handler that takes
args: Args.app_mentionevent.Expected result:
on_errorruns and logsoriginal error.Actual result:
The error handler itself crashes before it runs:
The original
RuntimeErroris lost. Inslack_bolt/kwargs_injection/utils.py(build_required_kwargs) andasync_utils.py,nextis removed from the available arguments for error handlers, butArgs(**all_available_args)is then built from that reduced dict, andArgsrequiresnext. The same code also usesarg_names.pop()on the listener's own list, so the list shrinks on every call.I have a fix with sync and async tests in #1592. It also adds an
errorfield toArgsso error handlers can read the exception throughargs.Requirements
I have read the Contributing guidelines and Code of Conduct.