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

hubot@>4.0.0 Cannot load adapter #653

Open
jdoss opened this issue Jul 7, 2023 · 11 comments
Open

hubot@>4.0.0 Cannot load adapter #653

jdoss opened this issue Jul 7, 2023 · 11 comments
Labels
auto-triage-skip bug M-T: A confirmed bug report. Issues are confirmed when the reproduction steps are documented

Comments

@jdoss
Copy link

jdoss commented Jul 7, 2023

Any version of Hubot greater than 4.0.0 can no longer use this adapter.

$ npm list -g
/usr/local/lib
+-- coffeescript@1.11.1
+-- corepack@0.18.0
+-- generator-hubot@0.4.0
+-- hubot-diagnostics@1.2.0
+-- hubot-plusplus@1.4.0
+-- hubot-redis-brain@1.0.0
+-- hubot-slack@4.10.0
+-- hubot-yubikey-invalidation@0.0.3
+-- hubot@5.0.6
+-- npm@9.6.7
`-- yo@4.3.1

node@35a610129064:~$ hubot
{"level":50,"time":1688759766927,"pid":194,"hostname":"35a610129064","name":"hubot","msg":"Cannot load adapter [no path set] slack - /usr/local/lib/node_modules/hubot-slack/src/bot.coffee:22:10: error: unexpected newline\n    super\u001b[1;31m\u001b[0m\n\u001b[1;31m         ^\u001b[0m"}

I had pin the following versions to get things working again.

npm install -g yo generator-hubot coffeescript@1.11.1 hubot@"<4.0.0" hubot-slack hubot-plusplus hubot-redis-brain hubot-diagnostics hubot-yubikey-invalidation
node@35a610129064:~$ npm list -g
/usr/local/lib
+-- coffeescript@1.11.1
+-- corepack@0.18.0
+-- generator-hubot@0.4.0
+-- hubot-diagnostics@1.2.0
+-- hubot-plusplus@1.4.0
+-- hubot-redis-brain@1.0.0
+-- hubot-slack@4.10.0
+-- hubot-yubikey-invalidation@0.0.3
+-- hubot@3.5.0
+-- npm@9.6.7
`-- yo@4.3.1

node@35a610129064:~$ hubot
[Fri Jul 07 2023 20:04:28 GMT+0000 (Coordinated Universal Time)] INFO hubot-slack adapter v4.10.0
warn: SlackDataStore is deprecated and will be removed in the next major version. See project documentation for a migration guide.
warn: SlackDataStore is deprecated and will be removed in the next major version. See project documentation for a migration guide.
[Fri Jul 07 2023 20:04:28 GMT+0000 (Coordinated Universal Time)] ERROR No token provided to Hubot
@zimeg zimeg added bug M-T: A confirmed bug report. Issues are confirmed when the reproduction steps are documented auto-triage-skip labels Jul 7, 2023
@zimeg
Copy link
Member

zimeg commented Jul 7, 2023

Hey @jdoss! Thank you for sharing this issue as well as a workaround for it!

Since this project is no longer under active development, there are no immediate plans to support the latest versions of Hubot. However, since others might encounter this same issue we can keep this issue open for now.

Really appreciate your investigation into this, and I also hope pinning to <4.0.0 is suitable for the bot you're building!

@jdoss
Copy link
Author

jdoss commented Jul 7, 2023

No problem @zimeg. Pinning to 4.0.0 works fine for my needs as I have an group of old coworkers in a slack and we can't seem to live without the hubot-plusplus plugin in our chat.

thinca added a commit to thinca/vim-jp-bot that referenced this issue Jul 23, 2023
Do not update Hubot to v4 or upper.
ref: slackapi/hubot-slack#653
Do not update CoffeeScript to v2 because unknown error occurred.
Do not update node-fetch to v3 because it is ES Module.

```shell
$ ncu --reject coffeescript,node-fetch -u
$ (edit line of "hubot" in package.json)
$ npm install
```
@joeyguerra
Copy link

I created a new Slack adapter for use with the latest Hubot version if you're interested in updating. I know it might be some work to update, though. Let me know how I can help.

@evercast-mahesh2021
Copy link

evercast-mahesh2021 commented Sep 7, 2023

I am also facing different issues while trying hubot-slack adapter.

npm list -g

/usr/local/lib
├── coffeescript@1.11.1
├── corepack@0.19.0
├── generator-hubot@0.4.0
├── hubot-diagnostics@1.2.0
├── hubot-plusplus@1.4.0
├── hubot-redis-brain@2.0.0
├── hubot-slack@4.10.0
├── hubot-yubikey-invalidation@0.0.3
├── hubot@3.5.0
├── n@9.1.0
├── npm@10.0.0
├── slack@11.0.2
└── yo@4.3.1

package.json

{
  "name": "test",
  "version": "0.0.0",
  "private": true,
  "author": "User <user@example.com>",
  "description": "A simple helpful robot for your Company",
  "dependencies": {
    "hubot": "3.5.0",
    "hubot-diagnostics": "^1.2.0",
    "hubot-google-images": "^0.2.7",
    "hubot-google-translate": "^0.2.1",
    "hubot-help": "^2.1.1",
    "hubot-heroku-keepalive": "^1.0.3",
    "hubot-maps": "^0.0.3",
    "hubot-pugme": "^0.1.1",
    "hubot-redis-brain": "^2.0.0",
    "hubot-rules": "^1.0.0",
    "hubot-scripts": "^2.17.2",
    "hubot-shipit": "^0.2.1",
    "hubot-slack": "^4.10.0"
  },
  "engines": {
    "node": "20.x"
  }
}

external-scripts.json

[
  "hubot-diagnostics",
  "hubot-help",
  "hubot-slack",
  "hubot-google-images",
  "hubot-google-translate",
  "hubot-pugme",
  "hubot-maps",
  "hubot-redis-brain",
  "hubot-rules",
  "hubot-shipit"
]

And after running: HUBOT_SLACK_TOKEN=xoxb-123-xyzn ./bin/hubot --adapter slack

Run `npm audit` for details.
[Thu Sep 07 2023 17:31:40 GMT+0000 (Coordinated Universal Time)] ERROR Cannot load adapter slack - /home/hubot/cleverbot/node_modules/hubot-slack/src/bot.coffee:22:10: error: unexpected newline
    super
         ^

Not sure what i am missing but i can't make it work. Any help would be appreciated.

@joeyguerra
Copy link

joeyguerra commented Sep 8, 2023

@evercast-mahesh2021, that error is because it's not running the script through coffee script.

I got a successful startup with these steps:

  1. given what you provided for package.json and external-scripts
  2. npm i coffeescript@1.11.1 <- Install coffeescript module within your app, as opposed to relying on the globally installed version
  3. add the following to the package.json file:
  "scripts": {
      "start": "hubot --adapter slack"
    }
  1. Run HUBOT_SLACK_TOKEN=xoxb-123-xyzn npm start
➜  myhubot git:(main) ✗ node --version
v20.6.0

@evercast-mahesh2021
Copy link

Hi @joeyguerra thank you so much for the help. I got passed this issue but facing another one. Any idea? It is complaining about hubot module. Thanks

Hubot> [Mon Sep 11 2023 15:01:20 GMT+0000 (Coordinated Universal Time)] ERROR Error loading scripts from npm package - TypeError: require(...) is not a function
  at /usr/local/lib/node_modules/hubot/src/robot.js:409:52
  at Array.forEach (<anonymous>:null:null)
  at Robot.loadExternalScripts (/usr/local/lib/node_modules/hubot/src/robot.js:409:25)
  at /usr/local/lib/node_modules/hubot/bin/hubot.js:203:13
  at FSReqCallback.readFileAfterClose [as oncomplete] (node:internal/fs/read/context:68:3)

@joeyguerra
Copy link

@evercast-mahesh2021 delete "hubot-slack", from external-scripts.json.

@evercast-mahesh2021
Copy link

@evercast-mahesh2021 delete "hubot-slack", from external-scripts.json.

Oh, awesome. It worked. Thanks for all the help.

@leonardoivt
Copy link

HI guys, has anyone managed to find any other solution? I followed all the previous steps with the same versions that were mentioned but I still have the same problem
ERROR Cannot load adapter slack - /home/hubot/node_modules/hubot-slack/src/bot.coffee:22:10: error: unexpected newline

@joeyguerra
Copy link

@leonardoivt I believe that error is from not having coffeescript installed. Post the results of npm list -g, your package.json file and command your executing so we can put another pair of eyes on it.

@leonardoivt
Copy link

hey @joeyguerra thanks for reply, sorry for taking so long to respond, I managed to solve the problem using the dependencie versions stipulated in this thread;
hubot : 3.5.0
coffeescript : 1.11.1

jonathansick added a commit to lsst-sqre/sqrbot that referenced this issue Nov 22, 2023
This may be necessary to ensure the app is transpiled correctly.

Use coffeescript 1.11.1 as suggested in
slackapi/hubot-slack#653
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-triage-skip bug M-T: A confirmed bug report. Issues are confirmed when the reproduction steps are documented
Projects
None yet
Development

No branches or pull requests

5 participants