mickhansen / ssacl-attribute-roles

Simple attribute whitelisting/blacklisting with roles for Sequelize
MIT License
62 stars 10 forks source link

Unhandled rejection RangeError: Maximum call stack size exceeded #4

Open eclipse1985 opened 9 years ago

eclipse1985 commented 9 years ago

Hi,

I'm experiencing some problems using your library (version 0.0.5). I use it in order to define visibility scope in various sequelize entities, for example:

cache: {
            type: DataTypes.TEXT,
            roles: {
                self: true
            }
        }

Sometimes, after an undefined number of call (a lot), I can't realize when exactly, a get this error:

Unhandled rejection RangeError: Maximum call stack size exceeded
    at target.Instance.get (/var/app/current/node_modules/ssacl-attribute-roles/lib/index.js:52:23)
    at target.Instance.get (/var/app/current/node_modules/ssacl-attribute-roles/lib/index.js:52:23)
    at target.Instance.get (/var/app/current/node_modules/ssacl-attribute-roles/lib/index.js:52:23)
    at target.Instance.get (/var/app/current/node_modules/ssacl-attribute-roles/lib/index.js:52:23)
    at target.Instance.get (/var/app/current/node_modules/ssacl-attribute-roles/lib/index.js:52:23)
    at target.Instance.get (/var/app/current/node_modules/ssacl-attribute-roles/lib/index.js:52:23)
    at target.Instance.get (/var/app/current/node_modules/ssacl-attribute-roles/lib/index.js:52:23)
    at target.Instance.get (/var/app/current/node_modules/ssacl-attribute-roles/lib/index.js:52:23)
    at target.Instance.get (/var/app/current/node_modules/ssacl-attribute-roles/lib/index.js:52:23)
    at target.Instance.get (/var/app/current/node_modules/ssacl-attribute-roles/lib/index.js:52:23)
    at target.Instance.get (/var/app/current/node_modules/ssacl-attribute-roles/lib/index.js:52:23)
    at target.Instance.get (/var/app/current/node_modules/ssacl-attribute-roles/lib/index.js:52:23)
    at target.Instance.get (/var/app/current/node_modules/ssacl-attribute-roles/lib/index.js:52:23)
    at target.Instance.get (/var/app/current/node_modules/ssacl-attribute-roles/lib/index.js:52:23)
    at target.Instance.get (/var/app/current/node_modules/ssacl-attribute-roles/lib/index.js:52:23)
    at target.Instance.get (/var/app/current/node_modules/ssacl-attribute-roles/lib/index.js:52:23)

can you help me?

mickhansen commented 9 years ago

I'm afraid i haven't encountered this error before. Anyway you can show me some code that reproduces this to some kind of certainty?

mickhansen commented 9 years ago

Hmm, are you calling ssaclAttributeRoles(sequelize|models) multiple times in your code over time? Looks like the code keeps calling itself whcih should only happen if the init code is called multiple times.

eclipse1985 commented 9 years ago

Yes, I noticed that I call it twice, I tried to fix and now I'm testing

mickhansen commented 9 years ago

Must be calling it more than twice, you must be calling it continously. Would be great to implement a check for this.

eclipse1985 commented 9 years ago

Ok, i fixed it.

mickhansen commented 9 years ago

I'm reopening to remind myself to throw an error if init'ed twice.