bennycode/coinbase-pro-node

Q: onopen does not trigger for authenticated socket in container

Closed this issue · 2 comments

The WebSocketEvent.ON_OPEN event does not trigger on an authenticated connection, when running in a docker container. The event does trigger when not running in a container. There are no errors. Authentication values are identical. For public sockets the ON_OPEN event is triggered both in a docker container, and outside.

const auth={ apiKey: mykey, apiSecret: mysecret, passphrase: mypass, useSandbox: false};
api.privateAPI=new CoinbasePro(auth);

api.privateAPI.ws.on(WebSocketEvent.ON_OPEN, async () => {
console.log("Socket open");
});

api.privateAPI.ws.connect();

Any ideas why this is working outside a docker container, but only for authenticated connections it is not inside a docker container?

This seems to be due to a missing dependency that is not listed in package.json or package-lock.json as copying the full node_modules into the container instead of a npm install solves the issue.

This project does not have a package-lock.json file, so I suggest using it by installing all dependencies using yarn.