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

Unable to connect clientAuthorizations #60

Closed
leoplct opened this issue Dec 28, 2017 · 2 comments
Closed

Unable to connect clientAuthorizations #60

leoplct opened this issue Dec 28, 2017 · 2 comments

Comments

@leoplct
Copy link

leoplct commented Dec 28, 2017

I am getting this error when I connect with APikey/secret.
Unable to connect: TypeError: Cannot read property 'add' of undefined

'use strict';
var SwaggerClient = require("swagger-client");
var _ = require('lodash');
var BitMEXAPIKeyAuthorization = require('./lib/BitMEXAPIKeyAuthorization');

require('dotenv').config();

new SwaggerClient({
  // Switch this to `www.bitmex.com` when you're ready to try it out for real.
  // Don't forget the `www`!
  url: 'https://testnet.bitmex.com/api/explorer/swagger.json',
  usePromise: true
})
.then(function(client) {
  //console.log(client);
  // Comment out if you're not requesting any user data.
  client.clientAuthorizations.add("apiKey", new BitMEXAPIKeyAuthorization(process.env.BITMEX_API_KEY, process.env.BITMEX_API_SECRET));

  // Print client capabilities
  //

})
.catch(function(e) {
  console.error("Unable to connect:", e);
})

@andersea
Copy link
Contributor

andersea commented Jan 7, 2018

Halt the script on this line in your debugger:

client.clientAuthorizations.add("apiKey", new BitMEXAPIKeyAuthorization(process.env.BITMEX_API_KEY, process.env.BITMEX_API_SECRET));

Inspect the client variable. Does it have an object 'clientAuthorizations'?

@ryanfox
Copy link
Contributor

ryanfox commented Jan 30, 2018

This sounds like it might be an installation issue. You might try re-installing the swagger-client module. Are there any steps you go through to reproduce the problem?

@ryanfox ryanfox closed this as completed May 7, 2018
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

3 participants