oebb-api icon indicating copy to clipboard operation
oebb-api copied to clipboard

TypeError: Cannot read property '0' of undefined

Open enthusiasmus opened this issue 7 years ago • 1 comments

const oebb = require('oebb-api');
oebb.searchStationsNew("Wien").then(console.log);

gives me an

Promise {
  <pending>,
  domain: 
   Domain {
     domain: null,
     _events: { error: [Function: debugDomainError] },
     _eventsCount: 1,
     _maxListeners: undefined,
     members: [] } }
> TypeError: Cannot read property '0' of undefined
    at Request.request [as _callback] (/home/lukas/projects/train_informer/node_modules/oebb-api/oebb.js:161:93)
    at Request.self.callback (/home/lukas/projects/train_informer/node_modules/request/request.js:186:22)
    at emitTwo (events.js:126:13)
    at Request.emit (events.js:214:7)
    at Request.<anonymous> (/home/lukas/projects/train_informer/node_modules/request/request.js:1163:10)
    at emitOne (events.js:116:13)
    at Request.emit (events.js:211:7)

Package-Version: 2.0.3 Node-Version: 8.9.4

Any ideas?

Best regards, Lukas

enthusiasmus avatar May 21 '18 18:05 enthusiasmus

Same problem here.

I recognized that there is no set-cookie header attribute in the response anymore. Just made a test modification, and it works.

Change this line https://github.com/mymro/oebb-api/blob/c13e465409d126b1e08773f797498174565d64fb/oebb.js#L158 to this one resolve(merge(body, {cookie: cookie.parse(response.headers.accesstoken)}));

T94T avatar Jun 20 '18 09:06 T94T