Skip to content
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

Strange Function Success / Failure Behavior #284

Open
anthonygualandri opened this issue Feb 22, 2024 · 8 comments
Open

Strange Function Success / Failure Behavior #284

anthonygualandri opened this issue Feb 22, 2024 · 8 comments
Labels
needs info not enough information to reproduce or continue

Comments

@anthonygualandri
Copy link

The deno-slack versions

Deno runtime version

OS info

Steps to reproduce

Getting kind of strange function behavior. When I run a function that calls an external api from inside of it, if the number of records returned by the call is somewhat large then the slack debug function output looks like this:

functions.completeSuccess request payload: { "outputs": {}, "function_execution_id": "Fx06LTHRJH9N" } functions.completeSuccess response payload: { ok: false, error: "token_revoked" }

But when I reduce the size of the payload returned it outputs this:

functions.completeSuccess request payload: { "outputs": {}, "function_execution_id": "Fx06L1U0AV9T" } functions.completeSuccess response payload: { ok: true }

Any idea what’s going on? What does the size of the payload have to do with whether or not slack accepts the slack token being used in the function call? Is there a timeout on functions that I’m not aware of? If so then payload response is not all that clear in order to understand what’s going on. Thanks for any light you can shed on this.

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.

@anthonygualandri anthonygualandri changed the title [BUG] Strange Function Success / Failure Behavior Strange Function Success / Failure Behavior Feb 22, 2024
@srajiang
Copy link
Member

@anthonygualandri -Hm, so that token_revoked error tells me Slack thinks that the step has already finished by the time you make the functions.completeSuccess call. Let me do a little asking around on this one.

@anthonygualandri
Copy link
Author

Thanks @srajiang. That functions.completeSuccess call is not being explicitly made by me in the code but by having the .env file flagged with SLACK_DEBUG=true. Just wanted to make sure that part was clear in case it has something to do with the implementation of that flag.

@mcsescott
Copy link

I am also see the token_revoked error with even the simple "hello world" app deployed locally.

I really think it has to do with the restriction that your function has to complete in 3 seconds, because that's what Slack has decided is the limit for local apps (vs deployed apps, which have a 15-second limit).

@srajiang srajiang added the needs info not enough information to reproduce or continue label Feb 23, 2024
@srajiang
Copy link
Member

Thanks for the context @anthonygualandri - so it's just a log, and you're not explicitly trying to complete the function. This does sound like the timeout issue @mcsescott refers to.

@srajiang
Copy link
Member

Alright, there's some ongoing internal discussion about the 3s vs. 15s timeouts, I don't have anything new to share on that front and so my best guess is that at the moment, this local vs. deployed app timeout distinction is sticking around.

@anthonygualandri are you able to to confirm whether you see this error in your deployed app? (Writing this, I know this is a little strange, given that you should be able to test under the same conditions you're deploying in 😞 ). But, if you ARE in a position to confirm that it doesn't happen in the deploy scenario, then that's informative.

@WilliamBergamin
Copy link
Contributor

I am also see the token_revoked error with even the simple "hello world" app deployed locally.

@mcsescott could you share the code and configuration of the "hello world" app, I don't seem to be able to reproduce this with the hello world sample project

My steps:

  1. slack create test-hello-world -t https://github.com/slack-samples/deno-hello-world
  2. cd test-hello-world/
  3. slack run + create the trigger
  4. test in a workspace

@mcsescott
Copy link

@WilliamBergamin

There is no logging for the app that can give you the token revoked message, but it appears I am getting hit by the 3-second limit that Slack has imposed on locally developed apps, which is a continual problem for development. 👎

test-hello-world.txt

@WilliamBergamin
Copy link
Contributor

Yess the 3-second limit has been a limiting feature for others as well, the simplest work around for this is to use some sort of message broker like amazon mq to offload long running processes to workers, allowing the request to be response within the timeout limit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs info not enough information to reproduce or continue
Projects
None yet
Development

No branches or pull requests

4 participants