You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using query builder we are are sometimes getting undefined returned from getMany() calls
Expected Behavior
If something goes wrong, e.g. a dropped connection or something similar, the library should throw an exception intead of returning undefined.
Or otherwise, if nothing goes wrong, just return an empty list.
Actual Behavior
In our error logging system we see null pointer errors for the following code
constdoubbleMatchesNotYetCreated=awaitmanager.getRepository(entity).createQueryBuilder().where(query).andWhere(()=>'some query that may or may not have results').orderBy('fooField').getMany();if(!doubbleMatchesNotYetCreated.length){return[];}
Because doubbleMatchesNotYetCreated is undefined.
Exactly why we do not know.
Steps to reproduce
We currently cannot provide these - errors seem sproadic. We will hotfix by making our result entities nullable with ?...
My Environment
Dependency
Version
Operating System
Debian 11.8
Node.js version
v18.19.0
Typescript version
5.2.2
TypeORM version
0.3.17
Additional Context
We are using CockroachDB with the Postgres Driver
Relevant Database Driver(s)
aurora-mysql
aurora-postgres
better-sqlite3
cockroachdb
cordova
expo
mongodb
mysql
nativescript
oracle
postgres
react-native
sap
spanner
sqlite
sqlite-abstract
sqljs
sqlserver
Are you willing to resolve this issue by submitting a Pull Request?
Yes, I have the time, but I don't know how to start. I would need guidance.
The text was updated successfully, but these errors were encountered:
We're seeing similar behavior with typeorm 0.3.20 (and node-postgres 8.11.3).
Specifically we've seen findOne() return undefined where we know that the row is present in the database, and where consecutive queries returned the object correctly.
const obj = await Obj.findOne({ where: { id } });
if (!obj) {
throw new Error("...");
}
We've only ever logged three instances of this error out of a lot of queries, and always at times of heavy load.
@alenap93 our assumption too was that if there was a connection or a query error TypeOrm would have returned an error — but we know it didn't. But then what gives?
Issue description
When using query builder we are are sometimes getting undefined returned from getMany() calls
Expected Behavior
If something goes wrong, e.g. a dropped connection or something similar, the library should throw an exception intead of returning undefined.
Or otherwise, if nothing goes wrong, just return an empty list.
Actual Behavior
In our error logging system we see null pointer errors for the following code
Because doubbleMatchesNotYetCreated is undefined.
Exactly why we do not know.
Steps to reproduce
We currently cannot provide these - errors seem sproadic. We will hotfix by making our result entities nullable with
?
...My Environment
Additional Context
We are using CockroachDB with the Postgres Driver
Relevant Database Driver(s)
Are you willing to resolve this issue by submitting a Pull Request?
Yes, I have the time, but I don't know how to start. I would need guidance.
The text was updated successfully, but these errors were encountered: