AlgoTrader / betfair-sports-api

Library is discontinued
MIT License
55 stars 15 forks source link

TypeError: Cannot set property 'port' of undefined in forever.js #5

Closed timhabermaas closed 12 years ago

timhabermaas commented 12 years ago

Hey,

following your tutorial I came across that exception. It was thrown on line 108 of forever.js. I'm using node v0.8.1 and setting options to an empty object if it's undefined solves the problem and I was able to login successfully:

function createConnectionSSL (port, host, options) {
  if (options == null)
    options = {}
  options.port = port
  options.host = host
  //return tls.connect(options)
  return tls.connect(port,host,options);
}

btw. I've been using node.js for like 5 minutes, so I don't feel comfortable forking your project and submitting a pull request. In fact, I've no idea why it's broken.

AlgoTrader commented 12 years ago

0.8 has changed API. quick fix is

function createConnectionSSL (options) {
  if (options == null)
    options = {}
  return tls.connect(options)
}

Node 0.8 is too early for production, I will support it in a week or two

AlgoTrader commented 12 years ago

Node 0.8 was released several days ago. I did not tried it yet. Node is very young and they changed HTTPS API a little bit. That's not a problem.

In node 0.6 createConnectionSSL has host, port and options parameters. In node 0.8 it gets options only.

AlgoTrader commented 12 years ago

implemented a fix. tested with node 0.6.19. Can you please test with node 0.8 and if it works, please close the issue

NPM package is updated

timhabermaas commented 12 years ago

Yes, the new version works fine with node 0.8. Thanks for the fast fix!

Great job on the tutorial, it was very easy to follow. :)

AlgoTrader commented 12 years ago

Wish to complete it, but have time problems!

natevw commented 11 years ago

For those finding this via Google, the relevant commit is here: https://github.com/AlgoTrader/betfair-sports-api/commit/9b62ce40783fc4b18e274920aebddab7a6a0cf63

(...wish this would have gotten filed as an issue or pull request on mikeal/request upstream earlier.)