Bolt-js: TypeError: Cannot read property 'id' of null for `enterprise.id`

Created on 6 Jan 2021  Â·  3Comments  Â·  Source: slackapi/bolt-js

Description

The error below happens when I click on a button on the app home page. I'm not sure if that's something I wasn't supposed to do (trigger a modal from an action on the home page). I also tend to think that the function buildSource should not be just checking if the enterprise.id is undefined, but also if it's null, shouldn't it?

$ node app.js
[DEBUG]  web-api:WebClient:0 initialized
[DEBUG]  web-api:WebClient:0 apiCall('auth.test') start
[DEBUG]  web-api:WebClient:0 will perform http request
[DEBUG]  web-api:WebClient:0 apiCall('auth.test') start
[DEBUG]  web-api:WebClient:0 will perform http request
[DEBUG]  web-api:WebClient:0 http response received
[DEBUG]  web-api:WebClient:0 http response received
/Users/theomelo/Workspace/Personal/catswisdom/node_modules/@slack/bolt/dist/App.js:502
                return bodyAsActionOrOptionsOrViewActionOrShortcut.enterprise.id;
                                                                              ^

TypeError: Cannot read property 'id' of null
    at /{omitted}/catswisdom/node_modules/@slack/bolt/dist/App.js:502:79
    at buildSource (/{omitted}/catswisdom/node_modules/@slack/bolt/dist/App.js:511:7)
    at App.processEvent (/{omitted}/catswisdom/node_modules/@slack/bolt/dist/App.js:284:24)
    at ExpressReceiver.requestHandler (/{omitted}/catswisdom/node_modules/@slack/bolt/dist/ExpressReceiver.js:141:77)
    at Layer.handle [as handle_request] (/{omitted}/catswisdom/node_modules/express/lib/router/layer.js:95:5)
    at next (/{omitted}/catswisdom/node_modules/express/lib/router/route.js:137:13)
    at exports.respondToUrlVerification (/{omitted}/catswisdom/node_modules/@slack/bolt/dist/ExpressReceiver.js:205:5)
    at Layer.handle [as handle_request] (/{omitted}/catswisdom/node_modules/express/lib/router/layer.js:95:5)
    at next (/{omitted}/catswisdom/node_modules/express/lib/router/route.js:137:13)
    at exports.respondToSslCheck (/{omitted}/catswisdom/node_modules/@slack/bolt/dist/ExpressReceiver.js:198:5)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

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

  • [ ] bug
  • [ ] enhancement (feature request)
  • [X] question
  • [ ] documentation related
  • [ ] example code related
  • [ ] testing related
  • [ ] discussion

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

  • [X] I've read and understood the Contributing guidelines and have done my best effort to follow them.
  • [X] I've read and agree to the Code of Conduct.
  • [X] 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: 2.6.0
  • node version: v15.5.1
  • OS version(s): MacOS Catalina 10.15.7 (19H114)

Steps to reproduce:

  1. → Go to app Home
  2. → Click on the action button
  3. → See the error as shown on the stack trace above.

Expected result:

I would expect a modal with the view I passed as an argument

Actual result:

The server closes with the error message: TypeError: Cannot read property 'id' of null

Attachments:

Source Code

Screen Shot 2021-01-05 at 6 22 27 PM
Screen Shot 2021-01-05 at 6 34 37 PM

bug

Most helpful comment

Fixed by #730

All 3 comments

I think this might be related to #726. I'm investigating this shortly

Fixed by #730

Just released version 2.6.1 to npm. Please reopen this issue if it isn't solved for you

Was this page helpful?
0 / 5 - 0 ratings

Related issues

johnsonsamuel picture johnsonsamuel  Â·  4Comments

dginovker picture dginovker  Â·  4Comments

TK95 picture TK95  Â·  3Comments

kmartin-215 picture kmartin-215  Â·  5Comments

malonehedges picture malonehedges  Â·  5Comments