New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attribute exclusion crashes when specified in defaultScope #4735

curiousdannii opened this Issue Oct 27, 2015 · 2 comments


5 participants

curiousdannii commented Oct 27, 2015

If I try to exclude an attribute (#4074) by default using defaultScope:

        defaultScope: {
            attributes: { exclude: [ 'documentation' ] },

An error is thrown:

    var attributes = Object.keys(this.tableAttributes);

TypeError: Cannot convert undefined or null to object
    at Function.keys (native)
    at Model.$expandAttributes (/home/dannii/i7el/node_modules/sequelize/lib/model.js:2592:29)
    at conformOptions (/home/dannii/i7el/node_modules/sequelize/lib/model.js:245:10)
    at Model.init (/home/dannii/i7el/node_modules/sequelize/lib/model.js:698:5)
    at Sequelize.define (/home/dannii/i7el/node_modules/sequelize/lib/sequelize.js:582:17)
    at module.exports (/home/dannii/i7el/db/Extension.js:7:19)

@curiousdannii curiousdannii changed the title from Attribute exclusions crashes when specified in defaultScope to Attribute exclusion crashes when specified in defaultScope Oct 27, 2015


This comment has been minimized.

phuvo commented Nov 1, 2015

+1. Workaround by using addScope('defaultScope') after defining the model.


This comment has been minimized.

matomesc commented Dec 15, 2015

Getting this as well on:


I believe that this.tableAttributes (which is undefined) should be this.attributes, which references the correct attributes object.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment