kengz / aiva

AIVA (A.I. Virtual Assistant): General-purpose virtual assistant for developers.

Home Page:http://kengz.me/aiva/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ERROR global-client-js promise exception with input: undefined

VansonLeung opened this issue · comments

The bot seems not manipulating my messages. And here is the debug logs. What should I do?

[Sat Jan 07 2017 16:24:39 GMT+0000 (UTC)] DEBUG [In log]: vanbot Hello
[Sat Jan 07 2017 16:24:39 GMT+0000 (UTC)] DEBUG Started global js socketIO client for SLACK at 6466
[Sat Jan 07 2017 16:24:39 GMT+0000 (UTC)] DEBUG Added a callback to hasher for global-client
[Sat Jan 07 2017 16:24:39 GMT+0000 (UTC)] DEBUG Added a callback to hasher for global-client
[Sat Jan 07 2017 16:24:39 GMT+0000 (UTC)] DEBUG IO on pass, msg: {
  "hash": "global-client-js_2324eb73fbc0094b55432d9359a4ab3b",
  "from": "global-client-js",
  "input": "Hello",
  "to": "nlp.cgkb-py",
  "intent": "parse"
} fn: undefined
[Sat Jan 07 2017 16:24:39 GMT+0000 (UTC)] DEBUG IO on pass, msg: {
  "hash": "global-client-js_ff6ce27311a4ae863af18b6a29d2d3c8",
  "from": "global-client-js",
  "input": "Hello",
  "to": "convo_classifier.py",
  "intent": "classify"
} fn: undefined
[Sat Jan 07 2017 16:24:39 GMT+0000 (UTC)] INFO global-client-js VYpSvkXutD82Y6j0AAAC joined, -2 remains
[Sat Jan 07 2017 16:24:39 GMT+0000 (UTC)] INFO All 5 IO clients have joined
[Sat Jan 07 2017 16:24:59 GMT+0000 (UTC)] ERROR 
global-client-js promise exception with input: undefined, to: {"input":"Hello","to":"nlp.cgkb-py","intent":"parse"}
global-client-js promise exception with input: undefined, to: {"input":"Hello","to":"convo_classifier.py","intent":"classify"}

You have to wait until all the clients have joined, i.e. when the counter hits zero, and for it to log

...
[Sat Jan 07 2017 16:24:39 GMT+0000 (UTC)] INFO All 5 IO clients have joined

before u can start messaging. Otherwise the nlp module from python will not be available to handle as it's still initializing

After trying to fix I got this:

> aiva@4.2.0 start /Users/vansonhk/Desktop/aiva
> bin/start

[ ------- Starting on local machine, not Docker ------- ]

> aiva@4.2.0 development /Users/vansonhk/Desktop/aiva
> mkdir -p ./logs; NODE_ENV=development ./node_modules/forever/bin/forever --minUptime=1000 --spinSleepTime=1000 --killSignal=SIGTERM --uid aiva-development -m 10 -a index.js | tee ./logs/aiva-development.log

[Sun Jan 08 2017 05:49:46 GMT+0000 (UTC)] INFO Authenticated database successfully
[Sun Jan 08 2017 05:49:57 GMT+0000 (UTC)] DEBUG 
Sequelize [Node: 6.4.0, CLI: 2.5.1, ORM: 3.29.0]

Loaded configuration file "config/db.json".
Using environment "development".
No migrations were executed, database schema was already up to date.

[Sun Jan 08 2017 05:49:57 GMT+0000 (UTC)] DEBUG globalConfig {
  "BOTNAME": "aivadev",
  "PORTS": {
    "NEO4J": 7476,
    "SOCKETIO": 6466,
    "SLACK": 8345,
    "TELEGRAM": 8443,
    "FB": 8545
  },
  "NGROK_AUTH": null,
  "ADMINS": [
    "your_chat_account@email.com"
  ],
  "TEST": {
    "HUBOT_SHELL_USER_ID": "ID0000001",
    "HUBOT_SHELL_USER_NAME": "alice"
  }
}
[Sun Jan 08 2017 05:49:57 GMT+0000 (UTC)] INFO Starting aiva process
[Sun Jan 08 2017 05:49:57 GMT+0000 (UTC)] INFO Starting poly-socketio server on port: 6466, expecting 4 IO clients
[Sun Jan 08 2017 05:49:57 GMT+0000 (UTC)] DEBUG adapterConfig {
  "ACTIVATE": true,
  "HUBOT_SLACK_TOKEN": "xoxb-125277929766-SXsRqJLz5aRaaVxdXXXXXXXX"
}
[Sun Jan 08 2017 05:49:57 GMT+0000 (UTC)] DEBUG import js lib from client.js
[Sun Jan 08 2017 05:49:57 GMT+0000 (UTC)] INFO Starting socketIO client for js at 6466
[Sun Jan 08 2017 05:49:57 GMT+0000 (UTC)] INFO Starting socketIO client for python at 6466
[Sun Jan 08 2017 05:49:57 GMT+0000 (UTC)] INFO Starting socketIO client for python at 6466
[Sun Jan 08 2017 05:49:57 GMT+0000 (UTC)] DEBUG Set SLACK PORT: 8348
[Sun Jan 08 2017 05:49:57 GMT+0000 (UTC)] DEBUG No WEBHOOK set for adapter SLACK
[Sun Jan 08 2017 05:49:57 GMT+0000 (UTC)] INFO Deploying bot aivadev with adapter SLACK
[Sun Jan 08 2017 05:49:57 GMT+0000 (UTC)] INFO js 3_TTVTgLK--qDKaRAAAA joined, 3 remains
[Sun Jan 08 2017 05:49:59 GMT+0000 (UTC)] ERROR Traceback (most recent call last):
  File "/Users/vansonhk/Desktop/aiva/lib/client.py", line 14, in <module>
    from py import *
  File "/Users/vansonhk/Desktop/aiva/lib/py/convo_classifier.py", line 5, in <module>

[Sun Jan 08 2017 05:49:59 GMT+0000 (UTC)] ERROR     from autocorrect import spell
ImportError: No module named autocorrect

[Sun Jan 08 2017 05:49:59 GMT+0000 (UTC)] INFO cgkb-py qZYUeAFY0uk1aJDzAAAB joined, 2 remains
[Sun Jan 08 2017 05:50:07 GMT+0000 (UTC)] INFO Logged in as vanbot of Vanport
[Sun Jan 08 2017 05:50:08 GMT+0000 (UTC)] INFO Slack client now connected
[Sun Jan 08 2017 05:50:11 GMT+0000 (UTC)] DEBUG Started global js socketIO client for SLACK at 6466
[Sun Jan 08 2017 05:50:15 GMT+0000 (UTC)] INFO global-client-js Lo9UN_HYsRSDJPqdAAAC joined, 1 remains
[Sun Jan 08 2017 05:50:38 GMT+0000 (UTC)] DEBUG [In log]: vanbot ds
[Sun Jan 08 2017 05:50:38 GMT+0000 (UTC)] DEBUG Started global js socketIO client for SLACK at 6466
[Sun Jan 08 2017 05:50:38 GMT+0000 (UTC)] DEBUG Added a callback to hasher for global-client
[Sun Jan 08 2017 05:50:38 GMT+0000 (UTC)] INFO global-client-js Lo9UN_HYsRSDJPqdAAAC joined, 0 remains
[Sun Jan 08 2017 05:50:38 GMT+0000 (UTC)] INFO All 4 IO clients have joined
[Sun Jan 08 2017 05:50:38 GMT+0000 (UTC)] DEBUG IO on pass, msg: {
  "hash": "global-client-js_61562e8f128575a540aaa5364aa2b312",
  "from": "global-client-js",
  "input": "ds",
  "to": "nlp.cgkb-py",
  "intent": "parse"
} fn: undefined
[Sun Jan 08 2017 05:50:38 GMT+0000 (UTC)] DEBUG Added a callback to hasher for global-client
[Sun Jan 08 2017 05:50:38 GMT+0000 (UTC)] DEBUG IO on pass, msg: {
  "hash": "global-client-js_fe0671a47b3ea86ce8f12a1b92a2133b",
  "from": "global-client-js",
  "input": "ds",
  "to": "convo_classifier.py",
  "intent": "classify"
} fn: undefined
[Sun Jan 08 2017 05:50:38 GMT+0000 (UTC)] DEBUG IO on pass, msg: {
  "output": null,
  "from": "cgkb-py",
  "hash": "global-client-js_61562e8f128575a540aaa5364aa2b312",
  "to": "global-client-js"
} fn: undefined
[Sun Jan 08 2017 05:50:38 GMT+0000 (UTC)] DEBUG hash string exists for global-client
[Sun Jan 08 2017 05:50:38 GMT+0000 (UTC)] DEBUG hasher.handle invoking cb for global-client
[Sun Jan 08 2017 05:50:38 GMT+0000 (UTC)] DEBUG hash string exists for global-client
global-client-js promise exception with input: undefined, to: {"input":"ds","to":"convo_classifier.py","intent":"classify"}
[Sun Jan 08 2017 05:50:58 GMT+0000 (UTC)] ERROR 

Also tried commenting the autocorrect library from the PY script and run again:

> aiva@4.2.0 start /Users/vansonhk/Desktop/aiva
> bin/start

[ ------- Starting on local machine, not Docker ------- ]

> aiva@4.2.0 development /Users/vansonhk/Desktop/aiva
> mkdir -p ./logs; NODE_ENV=development ./node_modules/forever/bin/forever --minUptime=1000 --spinSleepTime=1000 --killSignal=SIGTERM --uid aiva-development -m 10 -a index.js | tee ./logs/aiva-development.log

[Sun Jan 08 2017 05:56:25 GMT+0000 (UTC)] INFO Authenticated database successfully
[Sun Jan 08 2017 05:56:32 GMT+0000 (UTC)] DEBUG 
Sequelize [Node: 6.4.0, CLI: 2.5.1, ORM: 3.29.0]

Loaded configuration file "config/db.json".
Using environment "development".
No migrations were executed, database schema was already up to date.

[Sun Jan 08 2017 05:56:32 GMT+0000 (UTC)] INFO Starting aiva process
[Sun Jan 08 2017 05:56:32 GMT+0000 (UTC)] DEBUG globalConfig {
  "BOTNAME": "aivadev",
  "PORTS": {
    "NEO4J": 7476,
    "SOCKETIO": 6466,
    "SLACK": 8345,
    "TELEGRAM": 8443,
    "FB": 8545
  },
  "NGROK_AUTH": null,
  "ADMINS": [
    "your_chat_account@email.com"
  ],
  "TEST": {
    "HUBOT_SHELL_USER_ID": "ID0000001",
    "HUBOT_SHELL_USER_NAME": "alice"
  }
}
[Sun Jan 08 2017 05:56:33 GMT+0000 (UTC)] INFO Starting poly-socketio server on port: 6466, expecting 4 IO clients
[Sun Jan 08 2017 05:56:33 GMT+0000 (UTC)] DEBUG adapterConfig {
  "ACTIVATE": true,
  "HUBOT_SLACK_TOKEN": "xoxb-125277929766-SXsRqJLz5aRaaVxdXXXXXXXX"
}
[Sun Jan 08 2017 05:56:33 GMT+0000 (UTC)] DEBUG import js lib from client.js
[Sun Jan 08 2017 05:56:33 GMT+0000 (UTC)] INFO Starting socketIO client for js at 6466
[Sun Jan 08 2017 05:56:33 GMT+0000 (UTC)] INFO Starting socketIO client for python at 6466
[Sun Jan 08 2017 05:56:33 GMT+0000 (UTC)] INFO Starting socketIO client for python at 6466
[Sun Jan 08 2017 05:56:33 GMT+0000 (UTC)] DEBUG Set SLACK PORT: 8348
[Sun Jan 08 2017 05:56:33 GMT+0000 (UTC)] DEBUG No WEBHOOK set for adapter SLACK
[Sun Jan 08 2017 05:56:33 GMT+0000 (UTC)] INFO Deploying bot aivadev with adapter SLACK
[Sun Jan 08 2017 05:56:33 GMT+0000 (UTC)] INFO js 3MoD7aJyRbvpiT9NAAAA joined, 3 remains
[Sun Jan 08 2017 05:56:36 GMT+0000 (UTC)] INFO py 3K9CynG1ytHaDq_qAAAB joined, 2 remains
[Sun Jan 08 2017 05:56:36 GMT+0000 (UTC)] INFO cgkb-py b8yM1pBDVlHNZ7mtAAAC joined, 1 remains
[Sun Jan 08 2017 05:56:42 GMT+0000 (UTC)] INFO Logged in as vanbot of Vanport
[Sun Jan 08 2017 05:56:43 GMT+0000 (UTC)] INFO Slack client now connected
[Sun Jan 08 2017 05:56:46 GMT+0000 (UTC)] DEBUG Started global js socketIO client for SLACK at 6466
[Sun Jan 08 2017 05:56:51 GMT+0000 (UTC)] INFO global-client-js ctDCXVJQBuyt6NhNAAAD joined, 0 remains
[Sun Jan 08 2017 05:56:51 GMT+0000 (UTC)] INFO All 4 IO clients have joined
[Sun Jan 08 2017 05:57:01 GMT+0000 (UTC)] DEBUG [In log]: vanbot hi
[Sun Jan 08 2017 05:57:02 GMT+0000 (UTC)] DEBUG Started global js socketIO client for SLACK at 6466
[Sun Jan 08 2017 05:57:02 GMT+0000 (UTC)] INFO global-client-js ctDCXVJQBuyt6NhNAAAD joined, -1 remains
[Sun Jan 08 2017 05:57:02 GMT+0000 (UTC)] INFO All 4 IO clients have joined
[Sun Jan 08 2017 05:57:02 GMT+0000 (UTC)] DEBUG Added a callback to hasher for global-client
[Sun Jan 08 2017 05:57:02 GMT+0000 (UTC)] DEBUG IO on pass, msg: {
  "hash": "global-client-js_e891e9fa3feef25f69fd0c419b77f96a",
  "from": "global-client-js",
  "input": "hi",
  "to": "nlp.cgkb-py",
  "intent": "parse"
} fn: undefined
[Sun Jan 08 2017 05:57:02 GMT+0000 (UTC)] DEBUG Added a callback to hasher for global-client
[Sun Jan 08 2017 05:57:02 GMT+0000 (UTC)] DEBUG IO on pass, msg: {
  "hash": "global-client-js_411c620d9828cda39c6506be260bfcac",
  "from": "global-client-js",
  "input": "hi",
  "to": "convo_classifier.py",
  "intent": "classify"
} fn: undefined
[Sun Jan 08 2017 05:57:02 GMT+0000 (UTC)] DEBUG IO on pass, msg: {
  "output": null,
  "from": "cgkb-py",
  "hash": "global-client-js_e891e9fa3feef25f69fd0c419b77f96a",
  "to": "global-client-js"
} fn: undefined
[Sun Jan 08 2017 05:57:02 GMT+0000 (UTC)] DEBUG IO on pass, msg: {
  "output": null,
  "from": "py",
  "hash": "global-client-js_411c620d9828cda39c6506be260bfcac",
  "to": "global-client-js"
} fn: undefined
[Sun Jan 08 2017 05:57:02 GMT+0000 (UTC)] DEBUG hash string exists for global-client
[Sun Jan 08 2017 05:57:02 GMT+0000 (UTC)] DEBUG hasher.handle invoking cb for global-client
[Sun Jan 08 2017 05:57:02 GMT+0000 (UTC)] DEBUG hash string exists for global-client
[Sun Jan 08 2017 05:57:02 GMT+0000 (UTC)] DEBUG hash string exists for global-client
[Sun Jan 08 2017 05:57:02 GMT+0000 (UTC)] DEBUG hasher.handle invoking cb for global-client
[Sun Jan 08 2017 05:57:02 GMT+0000 (UTC)] DEBUG hash string exists for global-client
[Sun Jan 08 2017 05:57:02 GMT+0000 (UTC)] ERROR 

Empty error occurred and no response from Slack bot

Figured out that I should use Python3 otherwise

def wordvec_classify(input_str):
    input_str = clean_input(input_str)
    input_v = nlp(input_str)    <<< this line fails

so, resolved?

i think so
the only obstacle I face is that my computer is not using SSD hard drive. I let Spacy parse the language file for 10 minutes but still no response & failed to connect the sockets.

I deliberately changed the codes to support Python 2.7

Next time I research this framework I shall use Docker instead.