Gekko Forum
Error: cb(); is not a function - Printable Version

+- Gekko Forum (https://forum.gekko.wizb.it)
+-- Forum: Gekko (https://forum.gekko.wizb.it/forum-13.html)
+--- Forum: Technical Discussion (https://forum.gekko.wizb.it/forum-23.html)
+--- Thread: Error: cb(); is not a function (/thread-57413.html)



Error: cb(); is not a function - faldor - 07-21-2018

When importing a coin pair from Binance, and then running a live Gekko for paper trading I get the error:

_stream_writable.js:464
TypeError: cb is not a function
  at afterWrite (_stream_writable.js:464:3)

I tried swapping out the line:

return _.map(_.cloneDeep(batch), function(trade) {

in tradeBatcher.js so that it used .clone instead of .cloneDeep per this bug report on lodash https://github.com/nodejs/node/issues/10985 but results didn't change.

Weird thing is when I remove the coin pair data so that I get all the data from the exchange, I don't have the error. This happens with other coin pairs as well.

--UPDATE--
The error was coming from:
line 464: var state = stream._writableState;

in gekko-stable\node_modules\are-we-there-yet\node_modules\readable-stream\lib\_stream_writable.js.

I updated the line to just be = true and I no longer get the error. Can someone tell me why this is happening? My normal language is C# and this doesn't make sense to me. Also, anyone know the correct fix to make for it?


RE: Error: cb(); is not a function - askmike - 07-22-2018

Code:
TypeError: cb is not a function

Unfortunately that error and stack trace don't point to the actual problem, it's hard to properly debug async stuff in nodejs. This is a bug that definitely has something to do with the sqlite adapter, see this issue (for most likely the same problem): https://github.com/askmike/gekko/issues/2329


RE: Error: cb(); is not a function - faldor - 07-22-2018

Thanks for the reply!

It is definitely the same problem as the issue you linked. I am swapping from a windows to a ubuntu machine and will be doing a fresh install and import of history. Will let you know if this solves my problem. If it doesn't, will try using PostGreSQL.


RE: Error: cb(); is not a function - faldor - 07-22-2018

Wanted to follow up with results. I tried fresh install with both postgres/sqlite databases and don't get the problem ONLY IF data ins't loaded locally within the historySize timeframe. After doing an import of recent data for a coin pair, I get the error after it pieces together the data. Been trying to debug/find issue, but as you said the Async stuff is hard to debug.


RE: Error: cb(); is not a function - Derbeweis - 09-17-2018

any news here ?
i have the same error using PostGreSQL .. .my bots are on pm2 they keep restarting several times because of this cp error.. until it disappears and then they work..