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 'body' of undefined #5

Open
ashleypride opened this issue Oct 17, 2016 · 4 comments
Open

TypeError: Cannot read property 'body' of undefined #5

ashleypride opened this issue Oct 17, 2016 · 4 comments

Comments

@ashleypride
Copy link

Hi,

I've been using the API for months without issue, however, around the 9th of September it has failed with the following error:

root@pi20:/home/username# /home/username/node/bin/node /home/username/node/bin/node_modules/bg-hive-api/test.js
/home/username/node/bin/node_modules/bg-hive-api/index.js:108
var errorReason = JSON.parse(response.body);
^

TypeError: Cannot read property 'body' of undefined
at Object.callback (/home/username/node/bin/node_modules/bg-hive-api/index.js:108:54)
at next (/home/username/node/bin/node_modules/bg-hive-api/node_modules/async/lib/async.js:801:43)
at /home/username/node/bin/node_modules/bg-hive-api/node_modules/async/lib/async.js:32:16
at Request._callback (/home/username/node/bin/node_modules/bg-hive-api/Connection.js:63:9)
at self.callback (/home/username/node/bin/node_modules/bg-hive-api/node_modules/request/request.js:373:22)
at emitOne (events.js:77:13)
at Request.emit (events.js:169:7)
at Request.onRequestError (/home/username/node/bin/node_modules/bg-hive-api/node_modules/request/request.js:971:8)
at emitOne (events.js:77:13)
at ClientRequest.emit (events.js:169:7)

Thanks, Ash

@nosdod
Copy link

nosdod commented Oct 24, 2016

You can get this api to work again by editting node_modules/bg-hive-api/Connection.js so that line 47 has a comma on the end, and by adding the strictSSL line.
qs:undefined,
strictSSL: false

It will need more work to support the new v6 series API which BG are now using. You can investigate the current BG API at https://api.prod.bgchprod.info:8443/api/docs

I'm guessing that the URL used in this module will at some point get turned off ...

I hope to contribute more to this module if I manage to find the time!

Joe-houghton added a commit to Joe-houghton/bg-hive-api that referenced this issue Nov 18, 2016
strictSSL set to false as suggested by nosdod here: aklambeth#5 (comment)
@mmgti
Copy link

mmgti commented Jan 15, 2017

Using workaround has stopped working since the 4th Jan, gives the same error message as before - URL now turned off?

@jamesleesaunders
Copy link

The URL has changed from:
https://api.prod.bgchprod.info:443/omnia
To:
https://api-prod.bgchprod.info:443/omnia
And is now signed.

@aklambeth
Copy link
Owner

aklambeth commented Jan 17, 2017

The new signed v5 api appears to be on https://api-prod.bgchprod.info/api. The v6 api is on https://api-prod.bgchprod.info:443/omnia.
I've created a new 1.0.5 branch which points to the new url endpoint which seems to work for now.

Side note:- Now the url has a valid signed cert the "strictSSL" option no longer needs to be set to false.

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

No branches or pull requests

5 participants