nestjsx / crud

NestJs CRUD for RESTful APIs
https://github.com/nestjsx/crud/wiki
MIT License
4.1k stars 542 forks source link

No entity column "whereFactory" was found. after updating typeorm 0.2.25 #523

Open alexmantaut opened 4 years ago

alexmantaut commented 4 years ago

Hi, Since upgrading typeorm to 0.2.25, controller requests starting failing. Requests seem to work ok with typeorm 0.2.24 and lower.

Stack trace:

No entity column "whereFactory" was found. EntityColumnNotFound: No entity column "whereFactory" was found.
    at new EntityColumnNotFound (/home/alexm/projects/farmbot_be_v2/packages/core/node_modules/typeorm/error/EntityColumnNotFound.js:10:28)
    at /home/alexm/projects/farmbot_be_v2/packages/core/node_modules/typeorm/query-builder/QueryBuilder.js:599:35
    at Array.map (<anonymous>)
    at /home/alexm/projects/farmbot_be_v2/packages/core/node_modules/typeorm/query-builder/QueryBuilder.js:596:42
    at Array.map (<anonymous>)
    at SelectQueryBuilder.QueryBuilder.computeWhereParameter (/home/alexm/projects/farmbot_be_v2/packages/core/node_modules/typeorm/query-builder/QueryBuilder.js:594:40)
    at SelectQueryBuilder.andWhere (/home/alexm/projects/farmbot_be_v2/packages/core/node_modules/typeorm/query-builder/SelectQueryBuilder.js:317:71)
    at EventService.builderAddBrackets (/home/alexm/projects/farmbot_be_v2/node_modules/@nestjsx/crud-typeorm/lib/typeorm-crud.service.js:406:21)
    at EventService.setSearchCondition (/home/alexm/projects/farmbot_be_v2/node_modules/@nestjsx/crud-typeorm/lib/typeorm-crud.service.js:328:30)
    at EventService.createBuilder (/home/alexm/projects/farmbot_be_v2/node_modules/@nestjsx/crud-typeorm/lib/typeorm-crud.service.js:144:14)
    at EventService.getMany (/home/alexm/projects/farmbot_be_v2/node_modules/@nestjsx/crud-typeorm/lib/typeorm-crud.service.js:35:36)
    at EventController.getManyBase (/home/alexm/projects/farmbot_be_v2/node_modules/@nestjsx/crud/lib/crud/crud-routes.factory.js:170:33)
    at /home/alexm/projects/farmbot_be_v2/node_modules/@nestjs/core/router/router-execution-context.js:37:29
    at process._tickCallback (internal/process/next_tick.js:68:7) ExceptionsHandler

The request that causes this is just a getOne by id with no joins or filters.

Googling I found this issue. It appears that typeorm has changed the way non existing columns on a where are handled...

Getting into the stack trace on the debugger, it seems that the nestjx/crud createBuilder() sends an empty where to the query builder...

Can you tell me if I the latest version of typeorm works for anyone else or if I am doing something wrong?

Thanks,

vineetScaletech commented 2 years ago

Hey @alexmantaut ,

Did you find any way to solve this??

JaLe29 commented 2 years ago

same problem 0.2.45

Val-istar-Guo commented 2 years ago

Is there a solution to this problem? typeorm version: 0.2.45 No problem using version 0.2.44

soryy708 commented 1 year ago

Is a thing on 0.2.44 for us.

EntityColumnNotFound: No entity column "whereFactory" was found.
  at EntityColumnNotFound.TypeORMError [as constructor] (error/TypeORMError.ts:7:9)
  at new EntityColumnNotFound (error/EntityColumnNotFound.ts:5:9)
  at SelectQueryBuilder.Object.<anonymous>.QueryBuilder.findColumnsForPropertyPath (query-builder/QueryBuilder.ts:978:19)
  at SelectQueryBuilder.<anonymous> (query-builder/QueryBuilder.ts:1071:68)
  at step (../node_modules/typeorm/node_modules/tslib/tslib.js:143:27)
  at Object.next (../node_modules/typeorm/node_modules/tslib/tslib.js:124:57)
  at SelectQueryBuilder.Object.<anonymous>.QueryBuilder.getWhereCondition (query-builder/QueryBuilder.ts:1210:80)
  at SelectQueryBuilder.Object.<anonymous>.SelectQueryBuilder.andWhere (query-builder/SelectQueryBuilder.ts:733:71)

https://github.com/ppetzold/nestjs-paginate/issues/635