Repository navigation
Description
Issue Creation Checklist
- I understand that my issue will be automatically closed if I don't fill in the requested information
- I have read the contribution guidelines
Bug Description
Sequelize 6.28.1 will now throw an error if "undefined" is passed as a value to where. This is a backwards-incompatible breaking API change and per the semver definition should not be included in a minor version release.
This caused regressions for us all across across 10+ repos due to undefined previously being a supported value for where.
We do not explicitly pass undefined, but we have functions that accept filters as a parameter and it defaults to undefined, so if that function is called without any filters then undefined will be sent to sequelize. Yes, we could explicitly type-check for undefined before using them, but again given this is a breaking change I do not think it should have been in a minor version release. npm by default automatically upgrades you to any minor/patch versions (^ in package.json). Code that is written and works for one minor/patch version should always continue to work through any future minor/patch versions within that same major version.
Reproducible Example
const sequelize = new Sequelize('sqlite::memory:');
const User = sequelize.define('User', {
// Model attributes are defined here
firstName: {
type: DataTypes.STRING,
allowNull: false,
},
lastName: {
type: DataTypes.STRING,
},
});
const findAllUsers = (filters) => {
User.findAll({
where: filters,
});
};
findAllUsers();
What do you expect to happen?
No error would be thrown
What is actually happening?
Error is thrown: Error: Unsupported where option value: undefined. Please refer to the Sequelize documentation to learn more about which values are accepted as part of the where option.
Environment
- Sequelize version: 6.28.1
- Node.js version: N/A
- Database & Version: N/A
- Connector library & Version: N/A
Would you be willing to resolve this issue by submitting a Pull Request?
- Yes, I have the time and I know how to start.
- Yes, I have the time but I will need guidance.
- No, I don't have the time, but my company or I are supporting Sequelize through donations on OpenCollective.
- No, I don't have the time, and I understand that I will need to wait until someone from the community or maintainers is interested in resolving my issue.
Indicate your interest in the resolution of this issue by adding the 👍 reaction. Comments such as "+1" will be removed.
Activity
github-actions commentedon Feb 22, 2023
🎉 This issue has been resolved in version 6.28.2 🎉
The release is available on:
Your semantic-release bot 📦🚀
fix: fix 'WHERE parameter has invalid 'undefined' value error
fix: fix 'WHERE parameter has invalid 'undefined' value error (#2806)