apocas / dockerode

Docker + Node = Dockerode (Node.js module for Docker's Remote API)
Apache License 2.0
4.32k stars 460 forks source link

Error on getNetwork() #375

Closed ekkis closed 7 years ago

ekkis commented 7 years ago

In this issue: https://github.com/apocas/dockerode/issues/288 I see code that presumably works, but breaks for me. here's what I'm doing:

const Docker = require('dockerode');
const docker = new Docker();
console.log(docker.getNetwork('test'));

and the error I get is:

TypeError: callback is not a function at /Users/ekkis/tst/node_modules/dockerode/lib/network.js:43:7 at Modem.buildPayload (/Users/ekkis/tst/node_modules/docker-modem/lib/modem.js:255:7) at IncomingMessage. (/Users/ekkis/tst/node_modules/docker-modem/lib/modem.js:214:14) at emitNone (events.js:91:20) at IncomingMessage.emit (events.js:188:7) at endReadableNT (_stream_readable.js:974:12) at _combinedTickCallback (internal/process/next_tick.js:80:11) at process._tickDomainCallback (internal/process/next_tick.js:128:9)

if I look at the function I see:

Docker.prototype.getNetwork = function(id) {
  return new Network(this.modem, id);
};

and the network constructor looks like this:

var Network = function(modem, id) {
  this.modem = modem;
  this.id = id; 
};

so it's not clear to me at all how that error can be generated. what is clear is that the function doesn't require a callback. thoughts anyone?

p.s. working with v2.4.1

ekkis commented 7 years ago

ah. upgrade to v2.4.3 fixes the problem