Check your where
condition — it should not be an empty string. It requires a proper column name.
For example, somewhere you might be using an empty where
clause like ''
, which causes the error.
Try to use single inverted comma ' '
properly.
In my case, I was using this in an association, and that's why I was getting the error:
//gives me error
include: [{
model: User,
as: 'owner',
attributes: ['userId', '']
}]
//corrected code
include: [{
model: User,
as: 'owner',
attributes: ['userId']
}]