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
findOneOrFail(null) or findOneOrFail(undefined) should throw error #4373
Comments
+1 |
This needs to be fixed asap imo. If a null value is passed into a query TypeORM is retrieving a random record. This could cause serious data issues for someone. |
Can verify that the same issue is occurring with PostgreSQL as well. This is a serious bug and should be getting more attention. The fact that a random record is returned is very concerning. |
I recognized the same behavior on postgres. // This doesn't throw
function getCategoryById(id) {
return getRepository(CategoryEntity).findOneOrFail(id);
} // This throws
function getCategoryById(id) {
return getRepository(CategoryEntity).findOneOrFail({ id });
} I think this is related to the method overloading here. |
As @dtmzr mentioned, I experienced the first record always getting returned when where conditions weren't met using the following syntax:
It did however, work after removing the where:
Confusing overloading |
duplicate of 2990 |
Hey, @imnotjames the # was missing and therefore was not referenced. |
Oops duplicate of #2990 |
I just upgraded to 0.2.29 but it still happen 😢 |
Issue type:
[ ] question
[ x ] bug report
[ ] feature request
[ ] documentation issue
Database system/driver:
[ ]
cordova
[ ]
mongodb
[ x ]
mssql
[ ]
mysql
/mariadb
[ ]
oracle
[ ]
postgres
[ ]
cockroachdb
[ ]
sqlite
[ ]
sqljs
[ ]
react-native
[ ]
expo
TypeORM version:
[ x ]
latest
[ ]
@next
[ ]
0.x.x
(or put your version here)Steps to reproduce or a small repository showing the problem:
The text was updated successfully, but these errors were encountered: