neumino / rethinkdbdash

An advanced Node.js driver for RethinkDB with a connection pool, support for streams etc.
MIT License
848 stars 109 forks source link

RangeError: Maximum call stack size exceeded #375

Closed Lazrius closed 6 years ago

Lazrius commented 6 years ago

While trying to use rethinkdbdash I ran into an error that is preventing me making any such changes to my rethink database. I am still trying to work out the exact cause, but almost any query involving update/replace operations on objects seems to trigger an error.

(node:23248) UnhandledPromiseRejectionWarning: RangeError: Maximum call stack size exceeded
    at Function.Term.expr (node_modules\rethinkdbdash\lib\term.js:2381:14)
    at node_modules\rethinkdbdash\lib\term.js:2364:40
    at Object.loopKeys (node_modules\rethinkdbdash\lib\helper.js:56:14)
    at Function.Term.expr (node_modules\rethinkdbdash\lib\term.js:2362:12)
    at node_modules\rethinkdbdash\lib\term.js:2364:40
    at Object.loopKeys (node_modules\rethinkdbdash\lib\helper.js:56:14)
    at Function.Term.expr (node_modules\rethinkdbdash\lib\term.js:2362:12)
    at node_modules\rethinkdbdash\lib\term.js:2364:40
    at Object.loopKeys (node_modules\rethinkdbdash\lib\helper.js:56:14)
    at Function.Term.expr (node_modules\rethinkdbdash\lib\term.js:2362:12)
    at node_modules\rethinkdbdash\lib\term.js:2364:40
    at Object.loopKeys (node_modules\rethinkdbdash\lib\helper.js:56:14)
    at Function.Term.expr (node_modules\rethinkdbdash\lib\term.js:2362:12)
    at node_modules\rethinkdbdash\lib\term.js:2364:40
    at Object.loopKeys (node_modules\rethinkdbdash\lib\helper.js:56:14)
    at Function.Term.expr (node_modules\rethinkdbdash\lib\term.js:2362:12)

To give you an example of some of my queries that have caused this:

enableGreetMessage(id, update, channelName) {
        return this.r.table('custom').get(id).replace({
            greetmsg: { state: true, msg: update, channel: channelName }
        })
    }
enableGreetMessage(id, update, channelName) {
        return this.r.table('custom').get(id).update({
            greetmsg: { state: true, msg: update, channel: channelName }
        })
    }
changeMessageStatus(id, type, status, newMsg, channelName) {
        return this.r.table('custom').get(id).update({
            type: { state: status, msg: newMsg, channel: channelName }
        }).run()
    }

Been searching for solutions for ages, can't even find a hint to the cause, let alone the solution. Any and all advice is appreciated.

Edit: Turns out the values I was passing in were far too large for Rethink to store. Note to self: Do not shove massive objects inside.