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

TypeError: Object.values is not a function #16

Open
jwbensley opened this issue Aug 23, 2018 · 4 comments
Open

TypeError: Object.values is not a function #16

jwbensley opened this issue Aug 23, 2018 · 4 comments

Comments

@jwbensley
Copy link

jwbensley commented Aug 23, 2018

Hi there,

When I try to run your client I get the following stack dump

bensley@htpc-ubuntu:~$ slackadaisical
TypeError: Object.values is not a function
    at /home/bensley/.nvm/versions/node/v6.14.4/lib/node_modules/slackadaisical/dist/ChannelsList.js:314:43
    at Request._callback (/home/bensley/.nvm/versions/node/v6.14.4/lib/node_modules/slackadaisical/dist/SlackAPI.js:219:53)
    at Request.self.callback (/home/bensley/.nvm/versions/node/v6.14.4/lib/node_modules/slackadaisical/node_modules/request/request.js:185:22)
    at emitTwo (events.js:106:13)
    at Request.emit (events.js:191:7)
    at Request.<anonymous> (/home/bensley/.nvm/versions/node/v6.14.4/lib/node_modules/slackadaisical/node_modules/request/request.js:1161:10)
    at emitOne (events.js:96:13)
    at Request.emit (events.js:188:7)
    at IncomingMessage.<anonymous> (/home/bensley/.nvm/versions/node/v6.14.4/lib/node_modules/slackadaisical/node_modules/request/request.js:1083:12)
    at IncomingMessage.g (events.js:292:16)

This is my info:

# I did the "Fast Install"
$ echo "XXXXX" | tee ~/.slack_token # see below

# Slack token exists
bensley@htpc-ubuntu:~$ ls -l .slack_token
-rw-rw-r-- 1 bensley bensley 74 Aug 23 10:08 .slack_token

$ npm install -g slackadaisical
bensley@htpc-ubuntu:~$ npm install -g slackadaisical
/home/bensley/.nvm/versions/node/v6.14.4/bin/slackadaisical -> /home/bensley/.nvm/versions/node/v6.14.4/lib/node_modules/slackadaisical/dist/index.js

> [email protected] install /home/bensley/.nvm/versions/node/v6.14.4/lib/node_modules/slackadaisical/node_modules/websocket
> (node-gyp rebuild 2> builderror.log) || (exit 0)

make: Entering directory `/home/bensley/.nvm/versions/node/v6.14.4/lib/node_modules/slackadaisical/node_modules/websocket/build'
  CXX(target) Release/obj.target/bufferutil/src/bufferutil.o
  SOLINK_MODULE(target) Release/obj.target/bufferutil.node
  COPY Release/bufferutil.node
  CXX(target) Release/obj.target/validation/src/validation.o
  SOLINK_MODULE(target) Release/obj.target/validation.node
  COPY Release/validation.node
make: Leaving directory `/home/bensley/.nvm/versions/node/v6.14.4/lib/node_modules/slackadaisical/node_modules/websocket/build'
/home/bensley/.nvm/versions/node/v6.14.4/lib
└─┬ [email protected]
  ├── [email protected]
  ├── [email protected]
  ├─┬ [email protected]
  │ ├─┬ [email protected]
  │ │ └─┬ [email protected]
  │ │   └── [email protected]
  │ └── [email protected]
  ├─┬ [email protected]
  │ ├── [email protected]
  │ ├── [email protected]
  │ ├── [email protected]
  │ ├─┬ [email protected]
  │ │ └── [email protected]
  │ ├── [email protected]
  │ ├── [email protected]
  │ ├─┬ [email protected]
  │ │ └── [email protected]
  │ ├─┬ [email protected]
  │ │ ├─┬ [email protected]
  │ │ │ ├── [email protected]
  │ │ │ ├── [email protected]
  │ │ │ ├── [email protected]
  │ │ │ └── [email protected]
  │ │ └── [email protected]
  │ ├─┬ [email protected]
  │ │ ├── [email protected]
  │ │ ├─┬ [email protected]
  │ │ │ ├── [email protected]
  │ │ │ ├── [email protected]
  │ │ │ └─┬ [email protected]
  │ │ │   └── [email protected]
  │ │ └─┬ [email protected]
  │ │   ├── [email protected]
  │ │   ├── [email protected]
  │ │   ├── [email protected]
  │ │   ├── [email protected]
  │ │   ├── [email protected]
  │ │   ├── [email protected]
  │ │   └── [email protected]
  │ ├── [email protected]
  │ ├── [email protected]
  │ ├── [email protected]
  │ ├─┬ [email protected]
  │ │ └── [email protected]
  │ ├── [email protected]
  │ ├── [email protected]
  │ ├── [email protected]
  │ ├── [email protected]
  │ ├─┬ [email protected]
  │ │ ├── [email protected]
  │ │ └── [email protected]
  │ ├── [email protected]
  │ └── [email protected]
  ├─┬ [email protected]
  │ ├─┬ [email protected]
  │ │ └── [email protected]
  │ ├── [email protected]
  │ ├── [email protected]
  │ └── [email protected]
  └── [email protected]

bensley@htpc-ubuntu:~$ npm --version
3.10.10

bensley@htpc-ubuntu:~$ uname -a
Linux htpc-ubuntu 3.13.0-52-generic #86-Ubuntu SMP Mon May 4 04:32:59 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

bensley@htpc-ubuntu:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 14.04.5 LTS
Release:        14.04
Codename:       trusty
@jwbensley
Copy link
Author

Based on the info in this SO post I have upgraded my NodeJS to v7.10.1 and I can start the app now (sorry if this is basic info but I'm new to NodeJS):

https://stackoverflow.com/questions/40421825/how-to-use-object-values-on-server-side-in-node-js#40421941

Object.values is a new feature in ES2017. It is very bleeding edge. Node.js has full support for it from version 7.0.

6.8.1 supports it, but it is considered unstable and is locked behind the --harmony flag.

You can either:

Upgrade to the latest Node.js LTS and use --harmony
Upgrade to the latest Node.js Current
Use a polyfill
bensley@htpc-ubuntu:~$ nvm install 7.10.1
######################################################################## 100.0%
Checksums empty
Now using node v7.10.1 (npm v4.2.0)
bensley@htpc-ubuntu:~$ nvm use 7.10.1
Now using node v7.10.1 (npm v4.2.0)
bensley@htpc-ubuntu:~$ slackadaisical

I can start slackadaisical now but trying to select any room crashes:

TypeError: Cannot read property 'ts' of undefined
    at SlackAPI.markChannelRead (/usr/local/lib/node_modules/slackadaisical/dist/SlackAPI.js:137:76)
    at MessagesList.loadHistory (/usr/local/lib/node_modules/slackadaisical/dist/MessagesList.js:133:26)
    at /usr/local/lib/node_modules/slackadaisical/dist/MessagesList.js:87:23
    at Request._callback (/usr/local/lib/node_modules/slackadaisical/dist/SlackAPI.js:166:53)
    at Request.self.callback (/usr/local/lib/node_modules/slackadaisical/node_modules/request/request.js:185:22)
    at emitTwo (events.js:126:13)
    at Request.emit (events.js:214:7)
    at Request.<anonymous> (/usr/local/lib/node_modules/slackadaisical/node_modules/request/request.js:1161:10)
    at emitOne (events.js:116:13)
    at Request.emit (events.js:211:7)

@jwbensley
Copy link
Author

I've upgraded to the latest version available to me:

bensley@htpc-ubuntu:~$ nvm install 10.9.0
######################################################################## 100.0%
Checksums empty
Now using node v10.9.0 (npm v6.2.0)
bensley@htpc-ubuntu:~$ nvm use 10.9.0
Now using node v10.9.0 (npm v6.2.0)
bensley@htpc-ubuntu:~$ slackadaisical

I can join some channels but joining others still crasahes:

TypeError: Cannot read property 'ts' of undefined
    at SlackAPI.markChannelRead (/usr/local/lib/node_modules/slackadaisical/dist/SlackAPI.js:137:76)
    at MessagesList.loadHistory (/usr/local/lib/node_modules/slackadaisical/dist/MessagesList.js:133:26)
    at /usr/local/lib/node_modules/slackadaisical/dist/MessagesList.js:87:23
    at Request._callback (/usr/local/lib/node_modules/slackadaisical/dist/SlackAPI.js:166:53)
    at Request.self.callback (/usr/local/lib/node_modules/slackadaisical/node_modules/request/request.js:185:22)
    at Request.emit (events.js:182:13)
    at Request.<anonymous> (/usr/local/lib/node_modules/slackadaisical/node_modules/request/request.js:1161:10)
    at Request.emit (events.js:182:13)
    at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/slackadaisical/node_modules/request/request.js:1083:12)
    at Object.onceWrapper (events.js:273:13)

@tjcelaya
Copy link

tjcelaya commented Aug 23, 2018

@jwbensley your latest error looks a lot like #15

My workaround was to select channels with ^L and Enter so you might want to try that.

Regarding the version issue (which anyone can stumble over even if they're not new to node) you could open a PR updating the README to call out the required node version and/or update package.json with "engines" and "engineStrict" properties.

(note: not a maintainer just a user)

@jwbensley
Copy link
Author

Hi @tjcelaya - the solution to my problem was to log into Slack and change my "Mark as Read" settings.

Previously I had "Start me off where I left off, and mark the channel read" selected. I changed to "Start me at the newest message, but leave the unseen messages unread" and the issue stopped.

It seems the issue was that trying to change to a channel with unread messages, the Slackadaisical client would try to mark the channel/messages as read and crash as per my stack trace.

This has stopped now that I have changed the setting as per above.

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