BitMEX / api-connectors

Libraries for connecting to the BitMEX API.
https://www.bitmex.com/app/restAPI
909 stars 804 forks source link

Delta Server - Data.map #351

Open ChrisCates opened 5 years ago

ChrisCates commented 5 years ago

Should wrap data in a condition to prevent this stack trace:

TypeError: data.map is not a function
    at clone (/home/chris/Crypto/api-connectors/official-ws/delta-server/node_modules/bitmex-realtime-api/index.js:231:15)
    at BitMEXClient.getData (/home/chris/Crypto/api-connectors/official-ws/delta-server/node_modules/bitmex-realtime-api/index.js:98:10)
    at /home/chris/Crypto/api-connectors/official-ws/delta-server/lib/server.js:76:21
    at Layer.handle [as handle_request] (/home/chris/Crypto/api-connectors/official-ws/delta-server/node_modules/express/lib/router/layer.js:95:5)
    at next (/home/chris/Crypto/api-connectors/official-ws/delta-server/node_modules/express/lib/router/route.js:137:13)
    at Route.dispatch (/home/chris/Crypto/api-connectors/official-ws/delta-server/node_modules/express/lib/router/route.js:112:3)
    at Layer.handle [as handle_request] (/home/chris/Crypto/api-connectors/official-ws/delta-server/node_modules/express/lib/router/layer.js:95:5)
    at /home/chris/Crypto/api-connectors/official-ws/delta-server/node_modules/express/lib/router/index.js:281:22
    at param (/home/chris/Crypto/api-connectors/official-ws/delta-server/node_modules/express/lib/router/index.js:354:14)
    at param (/home/chris/Crypto/api-connectors/official-ws/delta-server/node_modules/express/lib/router/index.js:365:14)
mrbreaks commented 4 years ago

same error happen to me.

ChrisCates commented 4 years ago

@mrbreaks, I would send in a PR to fix this issue. But they've ghosted this issue.

verata-veritatis commented 4 years ago

Changing the clone function as outlined in the comment below fixed it for me.

https://github.com/BitMEX/api-connectors/issues/247#issuecomment-516070488

ChrisCates commented 4 years ago

@verata-veritatis, there still needs to be a conditional wrap around this source code. Can be put in a PR.

But again, Bitmex cannot be ghosting an issue before anyone sends a PR in.