-
Notifications
You must be signed in to change notification settings - Fork 393
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
Update SocketModeFunctions.ts #1553
Conversation
This will add necessary optional chaining when the body is undefined. This occurs when the app is running in socket mode and then socket mode is disabled from the app settings. Currently, when this happens the app will crash. The optional chaining here will prevent that.
@seratch I can't add reviewers now that I have submitted this. The maintainers (such as yourself?) will need to add them. Thanks! |
The root of this issue stems from why the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @rileyeaton thanks for catching this and contributing!
LGTM!
Codecov Report
@@ Coverage Diff @@
## main #1553 +/- ##
==========================================
- Coverage 82.08% 82.01% -0.07%
==========================================
Files 18 18
Lines 1496 1496
Branches 435 436 +1
==========================================
- Hits 1228 1227 -1
Misses 172 172
- Partials 96 97 +1
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
Summary
This PR will fix an issue where the bolt app will crash due to disabling socket mode while running. When this is disabled, the app crashes due to an attempt to access a key of an undefined value, body.type. All that is needed to avoid this crash is to add optional chaining.
This is the error that is displayed (locally) when socket mode is disabled:
This is because the event object is:
It is important that this is fixed because it cannot be caught by any users of this library as it is an internal process.
Please correct me if this pull request should be to a different base branch as I am not familiar with the current branch structure.
Requirements