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

Using the processBeforeResponse flag #4

Closed
rosgoo opened this issue Aug 11, 2020 · 3 comments
Closed

Using the processBeforeResponse flag #4

rosgoo opened this issue Aug 11, 2020 · 3 comments

Comments

@rosgoo
Copy link

rosgoo commented Aug 11, 2020

Hi @seratch, I am building a slack app on cloud functions (for now... cold starts are annoying...) and I think I should be using the processBeforeResponse as outlined in slackapi/bolt-js#444 but having issues figuring out how to use it. Is it as easy as just adding the option to my App constructor? Do I need to move by ack() calls to the end of my handler functions or can I keep them at the beginning?

@rosgoo rosgoo changed the title Using without ExpressReceiver and processBeforeResponse flag Updating to use processBeforeResponse flag Aug 11, 2020
@rosgoo rosgoo changed the title Updating to use processBeforeResponse flag Using the processBeforeResponse flag Aug 11, 2020
@seratch
Copy link
Owner

seratch commented Aug 11, 2020

Thanks for flagging this! Yes, this example should be updated.

Is it as easy as just adding the option to my App constructor?

Yes, it is. If you initialize ExpressReceiver manually, you need to set the flag to both App and ExpressReceiver.

Do I need to move by ack() calls to the end of my handler functions or can I keep them at the beginning?

No, you don't. When you turn on the option, your app waits for the whole completion of a listener function before sending an HTTP response to Slack regardless of the position of ack() calls.

@rosgoo
Copy link
Author

rosgoo commented Aug 12, 2020

Thanks! that worked fine!

@seratch
Copy link
Owner

seratch commented Aug 12, 2020

I've updated this example to be up-to-date. Let me close this issue now.

@seratch seratch closed this as completed Aug 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants