receiverAckTimeoutError should not throw if authorization of incoming event fails
See original GitHub issueDescription
When an incoming event fails to authenticate via Bolt’s authorizeFn
, the following warning is thrown:
https://github.com/slackapi/bolt/blob/227421b324bcf5548d1263db7b61fc66eb407908/src/App.ts#L395
Then, the following error is thrown that the incoming event is not acknowledged.
Is this the expected design? If listeners are not being called, why do we need to call ack()
?
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.
Bug Report
Filling out the following details about bugs will help us solve your issue sooner.
Reproducible in:
package version: >= 1.2.0
node version: v12.12.0
OS version(s): macOS Catalina 10.15.1
Steps to reproduce:
- With
authorizeFn
, do not authorize an incoming event.
Expected result:
Incoming event is not sent to listeners. receiverAckTimeoutError
is not thrown.
Actual result:
receiverAckTimeoutError
is thrown.
Attachments:
2020-01-02T15:25:13.64-0500 [APP/PROC/WEB/0] ERR { Error: Authorization of incoming event did not succeed.
2020-01-02T15:25:13.64-0500 [APP/PROC/WEB/0] ERR at Object.errorWithCode (/home/vcap/deps/0/node_modules/@slack/bolt/dist/errors.js:17:19)
2020-01-02T15:25:13.64-0500 [APP/PROC/WEB/0] ERR at authorizationErrorFromOriginal (/home/vcap/deps/0/node_modules/@slack/bolt/dist/App.js:293:28)
2020-01-02T15:25:13.64-0500 [APP/PROC/WEB/0] ERR at authorizeResult.authorize.catch (/home/vcap/deps/0/node_modules/@slack/bolt/dist/App.js:145:32)
2020-01-02T15:25:13.64-0500 [APP/PROC/WEB/0] ERR at process._tickCallback (internal/process/next_tick.js:68:7)
2020-01-02T15:25:13.64-0500 [APP/PROC/WEB/0] ERR code: 'slack_bolt_authorization_error',
2020-01-02T15:25:13.64-0500 [APP/PROC/WEB/0] ERR original:
2020-01-02T15:25:13.64-0500 [APP/PROC/WEB/0] ERR Error: No matching authorizations for E27SFGS2W:T0258Q0SG
2020-01-02T15:25:13.64-0500 [APP/PROC/WEB/0] ERR at App.module.exports [as authorize] (/home/vcap/app/src/authorizeFn.js:15:15)
2020-01-02T15:25:13.64-0500 [APP/PROC/WEB/0] ERR at App.onIncomingEvent (/home/vcap/deps/0/node_modules/@slack/bolt/dist/App.js:144:45)
2020-01-02T15:25:13.64-0500 [APP/PROC/WEB/0] ERR at ExpressReceiver.App.receiver.on.message (/home/vcap/deps/0/node_modules/@slack/bolt/dist/App.js:55:53)
2020-01-02T15:25:13.64-0500 [APP/PROC/WEB/0] ERR at ExpressReceiver.emit (events.js:198:13)
2020-01-02T15:25:13.64-0500 [APP/PROC/WEB/0] ERR at ExpressReceiver.requestHandler (/home/vcap/deps/0/node_modules/@slack/bolt/dist/ExpressReceiver.js:70:14)
2020-01-02T15:25:13.64-0500 [APP/PROC/WEB/0] ERR at Layer.handle [as handle_request] (/home/vcap/deps/0/node_modules/express/lib/router/layer.js:95:5)
2020-01-02T15:25:13.64-0500 [APP/PROC/WEB/0] ERR at next (/home/vcap/deps/0/node_modules/express/lib/router/route.js:137:13)
2020-01-02T15:25:13.64-0500 [APP/PROC/WEB/0] ERR at respondToUrlVerification (/home/vcap/deps/0/node_modules/@slack/bolt/dist/ExpressReceiver.js:122:5)
2020-01-02T15:25:13.64-0500 [APP/PROC/WEB/0] ERR at Layer.handle [as handle_request] (/home/vcap/deps/0/node_modules/express/lib/router/layer.js:95:5)
2020-01-02T15:25:13.64-0500 [APP/PROC/WEB/0] ERR at next (/home/vcap/deps/0/node_modules/express/lib/router/route.js:137:13) }
2020-01-02T15:25:13.64-0500 [APP/PROC/WEB/0] ERR [WARN] Authorization of incoming event did not succeed. No listeners will be called.
2020-01-02T15:25:16.44-0500 [APP/PROC/WEB/0] ERR { Error: An incoming event was not acknowledged before the timeout. Ensure that the ack() argument is called in your listeners.
2020-01-02T15:25:16.44-0500 [APP/PROC/WEB/0] ERR at receiverAckTimeoutError (/home/vcap/deps/0/node_modules/@slack/bolt/dist/ExpressReceiver.js:213:19)
2020-01-02T15:25:16.44-0500 [APP/PROC/WEB/0] ERR at Timeout.setTimeout [as _onTimeout] (/home/vcap/deps/0/node_modules/@slack/bolt/dist/ExpressReceiver.js:39:32)
2020-01-02T15:25:16.44-0500 [APP/PROC/WEB/0] ERR at ontimeout (timers.js:436:11)
2020-01-02T15:25:16.44-0500 [APP/PROC/WEB/0] ERR at tryOnTimeout (timers.js:300:5)
2020-01-02T15:25:16.44-0500 [APP/PROC/WEB/0] ERR at listOnTimeout (timers.js:263:5)
Issue Analytics
- State:
- Created 4 years ago
- Comments:9 (5 by maintainers)
Top Results From Across the Web
receiverAckTimeoutError should not throw if authorization of ...
Description. When an incoming event fails to authenticate via Bolt's authorizeFn , the following warning is thrown: https://github.com/slackapi/ ...
Read more >Bolt for JavaScript - Slack Platform Developer Tools
If the incoming request is not authorized or you're calling a method from outside of a listener, use the top-level app.client .
Read more >A Definitive Guide to Handling Errors in JavaScript - Kinsta
This error occurs when you try to invoke a method that doesn't exist in your script, or it does but can not be...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@aoberoi ☝️ This is a really good example of why I think
App.processEvent
in the proposal https://github.com/slackapi/bolt/issues/353#issuecomment-570650203 should reject with an error.I’ve confirmed that #891 can resolve this issue.
The above example app returns 401 HTTP status and shows the following logs only: