I am using a simple slash command event to trigger my lambda function from slack. I have a piece of code that is listening for the slash command:
main.py
@app.command("/echo")
@it_platform
def action_echo(ack, respond):
ack('HI')
# * Log to Cloudwatch
logging.info("The user {} triggered the command /echo")
respond('Hello user')
access.py
def it_platform(func):
@wraps(func)
def wrapper(*args, **kwargs):
logging.info(f"Arguments for it_platform {args}")
logging.info(f"Kwarguments for it_platform {kwargs}")
func(*args, **kwargs)
return wrapper
When i send the command /echo from my slack, i get the following error message:
[ERROR] 2022-08-08T05:03:06.984Z b38c38c8-ed45-46f2-80e8-8613da4ab0aa Failed to run listener function (error: action_echo() missing 2 required positional arguments: 'ack' and 'respond')
Traceback (most recent call last):
File "/opt/python/lib/python3.8/site-packages/slack_bolt/listener/thread_runner.py", line 65, in run
returned_value = listener.run_ack_function(
File "/opt/python/lib/python3.8/site-packages/slack_bolt/listener/custom_listener.py", line 49, in run_ack_function
return self.ack_function(
File "/var/task/models/neo_access.py", line 18, in wrapper
func(*args, **kwargs)
TypeError: action_echo() missing 2 required positional arguments: 'ack' and 'respond'`
If I remove the decorator it_platform from the function, it works fine. However, I need to have this decorator perform other tasks.
The slack_bolt version
slack_bolt version 1.11.4
Python runtime version
python3.8
OS info
serverless AWS Lambda x86_64
Steps to reproduce:
(Share the commands to run, source code, and project settings (e.g., setup.py))
1.
2.
3.
Expected result:
Decorator function it_platform to execute successfully
Actual result:
[ERROR] 2022-08-08T05:03:06.984Z b38c38c8-ed45-46f2-80e8-8613da4ab0aa Failed to run listener function (error: action_echo() missing 2 required positional arguments: 'ack' and 'respond')
Traceback (most recent call last):
File "/opt/python/lib/python3.8/site-packages/slack_bolt/listener/thread_runner.py", line 65, in run
returned_value = listener.run_ack_function(
File "/opt/python/lib/python3.8/site-packages/slack_bolt/listener/custom_listener.py", line 49, in run_ack_function
return self.ack_function(
File "/var/task/models/neo_access.py", line 18, in wrapper
func(*args, **kwargs)
TypeError: action_echo() missing 2 required positional arguments: 'ack' and 'respond'`
Hi @mervin-hemaraju-cko, this issue has been resolved (see https://github.com/slackapi/bolt-python/pull/689) in the recent release! Please upgrade to the latest version. Let me close this issue now.
I am using a simple slash command event to trigger my lambda function from slack. I have a piece of code that is listening for the slash command:
main.py
access.py
When i send the command
/echo
from my slack, i get the following error message:If I remove the decorator
it_platform
from the function, it works fine. However, I need to have this decorator perform other tasks.The
slack_bolt
versionslack_bolt version 1.11.4
Python runtime version
python3.8
OS info
serverless AWS Lambda x86_64
Steps to reproduce:
(Share the commands to run, source code, and project settings (e.g., setup.py))
1. 2. 3.
Expected result:
Decorator function
it_platform
to execute successfullyActual result:
Requirements
Please read the Contributing guidelines and Code of Conduct before creating this issue or pull request. By submitting, you are agreeing to those rules.