maxbeatty / hubot-uber

Hubot script to get Uber estimates
MIT License
11 stars 1 forks source link

Uber API call error #2

Closed mwarkentin closed 9 years ago

mwarkentin commented 9 years ago

I was playing around with this (great idea!).. went through and set up my office coordinates, set it as default, etc. When I went to use a command that made a call to the Uber API, I got the following:

hubot uber products
Hubot> [Thu Nov 20 2014 11:41:03 GMT-0500 (EST)] ERROR TypeError: Cannot read property 'length' of undefined
  at /Users/mwarkentin/waveapps/src/sandbox/wabot/node_modules/hubot-uber/src/uber.coffee:120:9, <js>:117:35
  at IncomingMessage.<anonymous> (/Users/mwarkentin/waveapps/src/sandbox/wabot/node_modules/hubot/node_modules/scoped-http-client/lib/index.js:70:20)
  at IncomingMessage.EventEmitter.emit (events.js:117:20)
  at _stream_readable.js:920:16
  at process._tickCallback (node.js:415:13)
maxbeatty commented 9 years ago

Just from looking at the code, I'm guessing the JSON response didn't have products. Can you share your coordinates for me to test against? Guessing the solution is to verify that parsed JSON has what's needed before continuing.

mwarkentin commented 9 years ago

@maxbeatty Here are the coordinates I used: 43.663424, -79.340840

Ah.. just took a look at the code and realized that I need an Uber token in my config - might want to add something to the readme about that. :smile:

maxbeatty commented 9 years ago

Added a Configure section to the README and will now log a warning if the env var is missing

mwarkentin commented 9 years ago

Nice.. thanks!