Closed curious-broccoli closed 1 month ago
Hi @curious-broccoli thanks for writing in 💯
Bolt-js and Bolt-python operate slightly differently. Calling the next()
method allows the following middleware and the handler to execute, this ensures that a response is sent for each request.
If a global middleware raises an Exception or returns
early then no response is sent for the request, this may lead to unexpected behaviors like retries and errors. In most cases the handler should respond appropriately to the request based on the data collected by the middleware. This is why next()
is shown in our documentation.
Depending on what an app is trying to accomplish it may be valid to return
early in a middleware but this may lead to unexpected behaviors.
The page URLs
Issue
In the current example I think the function is always executed till the end and
next
is always called, which means the event callback will be called even if authentication failed.Change
Similar to bolt-js example it should probably return if authentication fails and not proceed to the next middleware.