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

Better supports for Events API on FaaS #395

Closed
5 of 9 tasks
seratch opened this issue Feb 5, 2020 · 10 comments
Closed
5 of 9 tasks

Better supports for Events API on FaaS #395

seratch opened this issue Feb 5, 2020 · 10 comments
Assignees
Labels
enhancement M-T: A feature request for new functionality semver:major
Milestone

Comments

@seratch
Copy link
Member

seratch commented Feb 5, 2020

Description

Related to #361, I would like to introduce a new option to AppOptions in the next minor version or Bolt 2.

I would love to get you all's suggestions for better naming but it is a flag to turn on/off the automatic Events API request acknowledgment. It allows developers to customize the behavior here: https://github.com/slackapi/bolt/blob/%40slack/bolt%401.5.0/src/App.ts#L474-L475

If we go with a name like autoEventAck, the default value is supposed to be true. If a developer set it as false, the app.event listener has ack function and it's expected to call it for sure.

This is necessary to run Bolt apps safely on FaaS (Function-as-a-Service). Without this, Events API handlers may unexpectedly be terminated even while they're still running.

What type of issue is this? (place an x in one of the [ ])

  • bug
  • enhancement (feature request)
  • question
  • documentation related
  • testing related
  • discussion

Requirements (place an x in each of the [ ])

  • I've read and understood the Contributing guidelines and have done my best effort to follow them.
  • I've read and agree to the Code of Conduct.
  • I've searched for any related issues and avoided creating a duplicate issue.
@seratch seratch added enhancement M-T: A feature request for new functionality semver:minor labels Feb 5, 2020
@seratch seratch self-assigned this Feb 5, 2020
@seratch
Copy link
Member Author

seratch commented Feb 5, 2020

@aoberoi @stevengill @shaydewael
Could you check the followings?

  • Do you agree with this idea?
  • If so, do you have better names for the flag in mind?

@aoberoi
Copy link
Contributor

aoberoi commented Feb 5, 2020

My biggest concern is introducing an option for this behavior makes sample code, middleware, and documentation less portable. If some apps have the option set to the opposite of the default, they have to be very careful to comb through all their code to modify .event() listenerse (and middleware which operate on events) to do the right thing. In documentation, we'll have to add caveats about this in many places.

I think the optionality will fragment our audience and increase our effort. Is that worth it?

Why can't the FaaS implementation send responses after the event is fully processed (which it can in v2)? Even the .action() listeners who call ack() shouldn't actually send the response until the event is fully processed. This alternate behavior can be full encapsulated in a Receiver implementation.

@seratch
Copy link
Member Author

seratch commented Feb 5, 2020

@aoberoi
Thanks for your prompt response! I agree there is a downside you pointed out.

Why can't the FaaS implementation send responses after the event is fully processed (which it can in v2)?

This is also an option. One thing I need to mention here is that if a Receiver awaits for the completion of listeners, it may result in a 3-second timeout.

If we go with your idea, we may should mention the possibility of the ack timeouts and also encourage developers to consider some ways to handle async executions (e.g., Promises for class app hosting, queues/function-invocations for FaaS) in Bolt documents.

Thanks for the great suggestion. Now, I'm happy to go with changing the ack() behavior in v2 to await for listener completion.

@seratch seratch changed the title Add autoEventAck?: boolean to AppOptions Discussion: Better supports for Events API on FaaS Feb 5, 2020
@seratch seratch added this to the V2 milestone Feb 5, 2020
@seratch
Copy link
Member Author

seratch commented Mar 26, 2020

PR #444 is going to add a new flag to enable developers to customize the behavior of ack() to await for the listener's completion. The option will be a solution for the issue described here.

@seratch seratch modified the milestones: v2.0, v2.1 Mar 26, 2020
@aoberoi aoberoi modified the milestones: v2.1, v2.0 Mar 27, 2020
@aoberoi
Copy link
Contributor

aoberoi commented Mar 27, 2020

Is this issue a duplicate of #361? Or can it also be closed because we've converged on a solution and the discussion is done?

@seratch
Copy link
Member Author

seratch commented Mar 27, 2020

We don't have anything further to discuss but in my opinion, we can close this issue when we merge #444 - we're almost fixing this but still in progress.

@seratch seratch changed the title Discussion: Better supports for Events API on FaaS Better supports for Events API on FaaS Mar 27, 2020
@seratch
Copy link
Member Author

seratch commented Mar 31, 2020

As mentioned in the version 2.0.0, #444 has been merged and the option called processBeforeResponse is available for FaaS users.
https://github.com/slackapi/bolt/releases/tag/%40slack%2Fbolt%402.0.0

@seratch seratch closed this as completed Mar 31, 2020
@seratch seratch reopened this Apr 1, 2020
@seratch
Copy link
Member Author

seratch commented Apr 1, 2020

Let me reopen this issue. I noticed that processBeforeReponse option doesn't work as expected. I will come up with a pull request addressing the issue.

@aoberoi
Copy link
Contributor

aoberoi commented Apr 4, 2020

I'd prefer to close this issue, and create a new issue to track the bug in the intended behavior. The feature is implemented, but we're now investigating a reported issue with the implementation.

@aoberoi aoberoi closed this as completed Apr 4, 2020
@seratch
Copy link
Member Author

seratch commented Apr 4, 2020

Agreed. The issue for the bug is #462 (for reference)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement M-T: A feature request for new functionality semver:major
Projects
None yet
Development

No branches or pull requests

2 participants