-
Notifications
You must be signed in to change notification settings - Fork 235
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Slack API revokes an access token after some time when running the code in Lambda #1075
Comments
Hi, @jota12x! Thank you for submitting this question 😄 We consulted internally about how long tokens delivered in the
To answer the other questions:
As far as I know, there is no way to manipulate this with the APIs or SDKs - this is preset based on internal code.
This scenario seems edge case-y, so I'm unsure if token rotation would solve this at all. Based on the token expiration criteria mentioned above where the tokens either expire 15 mins after being issued OR are revoked when the step is completed, I would first suggest looking into if I hope this helps - let me know if you have further questions! 🙌 |
@hello-ashleyintech Thank you for your prompt and throughout answer.
Sorry, I forgot to add
My lambda function runs for around two minutes. Is that too much? For instance, if I comment enough lines, the second message certainly reaches the API. By the way, I ran my app in Socket mode, and it works as expected. Is there any difference for the token's handling in Socket mode? 🤔 |
@jota12x It does seems like something in the lambda function is running too long - could it be that it takes a while to actually initialize and start the Lambda function with its dependencies? I recommend checking your code with these examples to make sure that it aligns with how you're calling your function.
It could have something to do with Socket Mode requiring an app token. I'm not 100% sure on this though, but you can learn more about the app token vs. bot token here. |
@hello-ashleyintech Thank you for the resources. I continued testing and realized that the token is revoked if the Lambda runs for more than one second. Maybe is related to this doc .
So, is it possible to run lazy code inside a custom function or workflow step? 🤔 From what I checked, the documentation only refers to commands. |
Hi, I'm implementing a single-organization Slack app that receives data from a workflow form and creates some resources in AWS. To accomplish this, my app has a custom function that the code listens to, similar to this:
My app works locally, however when deploying it to Lambda, the Slack API revokes the access token after the AWS resource creation, resulting in the second message being ignored
Furthermore, if I remove the AWS processing, both messages are sent to the channel, so I suspect the problem lies on the expiration time for the access token. My questions are:
Reproducible in:
The
slack_bolt
versionslack-bolt 1.19.0rc1
Python runtime version
3.11.0
(Paste the output of
python --version
)OS info
arm64 (lambda)
The text was updated successfully, but these errors were encountered: