redis-oplog
redis-oplog copied to clipboard
callback is not a function error when using SyntheticMutator.update
I'm following the Synthetic mutation example in the documentation. But whenever I call on SyntheticMutator.update()
, I'm getting this error
/home/rj/.meteor/packages/cultofcoders_redis-oplog/.1.2.7_1.13z1z2p.8gfs++os+web.browser+web.cordova/npm/node_modules/redis/lib/utils.js:89
callback(err, res);
^
TypeError: callback is not a function
at Object.callbackOrEmit [as callback_or_emit] (/home/rj/.meteor/packages/cultofcoders_redis-oplog/.1.2.7_1.13z1z2p.8gfs++os+web.browser+web.cordova/npm/node_modules/redis/lib/utils.js:89:9)
at RedisClient.return_error (/home/rj/.meteor/packages/cultofcoders_redis-oplog/.1.2.7_1.13z1z2p.8gfs++os+web.browser+web.cordova/npm/node_modules/redis/index.js:706:11)
at JavascriptRedisParser.returnError (/home/rj/.meteor/packages/cultofcoders_redis-oplog/.1.2.7_1.13z1z2p.8gfs++os+web.browser+web.cordova/npm/node_modules/redis/index.js:196:18)
at JavascriptRedisParser.execute (/home/rj/.meteor/packages/cultofcoders_redis-oplog/.1.2.7_1.13z1z2p.8gfs++os+web.browser+web.cordova/npm/node_modules/redis-parser/lib/parser.js:572:12)
at Socket.<anonymous> (/home/rj/.meteor/packages/cultofcoders_redis-oplog/.1.2.7_1.13z1z2p.8gfs++os+web.browser+web.cordova/npm/node_modules/redis/index.js:274:27)
at emitOne (events.js:116:13)
at Socket.emit (events.js:211:7)
at addChunk (_stream_readable.js:263:12)
at readableAddChunk (_stream_readable.js:250:11)
at Socket.Readable.push (_stream_readable.js:208:10)
at TCP.onread (net.js:597:20)
Exited with code: 1
Your application is crashing. Waiting for file change.
Here are the calls done within my method call. When these lines were commented, there were no errors
if (status) {
SyntheticMutator.update(SupportUsers, ticketId, {
$addToSet: {
currentlyTyping: this.userId
}
});
} else {
SyntheticMutator.update(SupportUsers, ticketId, {
$pull: {
currentlyTyping: this.userId
}
});
}
Same issue for me with SyntheticMutator.insert
. I suppose that Vent
can also be used to emulate the writes, but it requires syncing data from multiple subscriptions on the client which is not really ideal.
@theodorDiaconu, can you give a clue on what we should be looking at to be able to fix this?
It's because channel
variable here is an array while it should be a string. This is the line that causes that bug.
@dovydaskukalis were you able to make this work?
@dovydaskukalis thanks for tracking down where the error was coming from, I created a PR to fix it which is working on my local computer.
@dovydaskukalis were you able to make this work?
Yes, we also need to pass _id
to _extractChannels()
for it to work properly like in this PR https://github.com/cult-of-coders/redis-oplog/pull/358
Thanks @jamesgibson14 & @dovydaskukalis
I am getting the same error. Any resolution?