PhilWaldmann / openrecord

Make ORMs great again!
https://openrecord.js.org
MIT License
486 stars 38 forks source link

RangeError: Maximum call stack size exceeded #103

Closed Feelthewind closed 4 years ago

Feelthewind commented 4 years ago

I tried to get all the rows from one of my tables and got this error. I used several ways to solve this. (await Currency, await Currency({unit_currency_fl: 'eth'}) and so on) If i directly used the query that is maded by openrecord, it works. I don't know why this happens.

at Function.keys () at Object.exports.clone (C:\Users\lcs\projects\api.v2.ms1.coint.me_alpha\node_modules\openrecord\lib\utils.js:87:12) at C:\Users\lcs\projects\api.v2.ms1.coint.me_alpha\node_modules\openrecord\lib\utils.js:91:29 at Array.forEach () at Object.exports.clone (C:\Users\lcs\projects\api.v2.ms1.coint.me_alpha\node_modules\openrecord\lib\utils.js:87:22) at C:\Users\lcs\projects\api.v2.ms1.coint.me_alpha\node_modules\openrecord\lib\utils.js:91:29 at Array.forEach () at Object.exports.clone (C:\Users\lcs\projects\api.v2.ms1.coint.me_alpha\node_modules\openrecord\lib\utils.js:87:22) at C:\Users\lcs\projects\api.v2.ms1.coint.me_alpha\node_modules\openrecord\lib\utils.js:91:29 at Array.forEach () at Object.exports.clone (C:\Users\lcs\projects\api.v2.ms1.coint.me_alpha\node_modules\openrecord\lib\utils.js:87:22) at C:\Users\lcs\projects\api.v2.ms1.coint.me_alpha\node_modules\openrecord\lib\utils.js:91:29 at Array.forEach () at Object.exports.clone (C:\Users\lcs\projects\api.v2.ms1.coint.me_alpha\node_modules\openrecord\lib\utils.js:87:22) at C:\Users\lcs\projects\api.v2.ms1.coint.me_alpha\node_modules\openrecord\lib\utils.js:91:29 at Array.forEach ()

PhilWaldmann commented 4 years ago

Hi @Feelthewind it seems that you have some kind of circular dependency in your model definition. Please post your model definition of Currency.

await Currency({unit_currency_fl: 'eth'})should not work! I guess it's a condition, so the following code will do it: await Currency.where({unit_currency_fl: 'eth'})