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

TypeError: Cannot read property '0' of undefined #1

Open
enthusiasmus opened this issue May 21, 2018 · 1 comment · May be fixed by #2
Open

TypeError: Cannot read property '0' of undefined #1

enthusiasmus opened this issue May 21, 2018 · 1 comment · May be fixed by #2

Comments

@enthusiasmus
Copy link

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

@T94T
Copy link

T94T commented Jun 20, 2018

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

resolve(merge(body, {cookie: cookie.parse(response.headers['set-cookie'][0])['ts-cookie']}));

to this one
resolve(merge(body, {cookie: cookie.parse(response.headers.accesstoken)}));

@mscharl mscharl linked a pull request Aug 4, 2019 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants