TypeError: Cannot read property 'databaseName' of undefined

See original GitHub issue

Issue type: [x] bug report

Database system/driver: [x] mssql

TypeORM version: [x] latest

Steps to reproduce or a small repository showing the problem:

Here is a repo with the bug: https://github.com/victorschinaider/typeorm-bug

I think pagination+ embedded orderBy+ subquery + leftJoinAndSelect combination is giving me the problem.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:21
  • Comments:30 (4 by maintainers)

github_iconTop GitHub Comments

47reactions
mirkadevcommented, Jun 1, 2021

So, I just replaced take with limit and it works for me.

46reactions
antowkabondcommented, Oct 27, 2020

I have the same issues. As for me, it helps

@Entity({name: 'categories'})
export class Category extends BaseEntity {
    @PrimaryGeneratedColumn()
    public id: number;

    @Column({name: 'my_name'})
    public name: string;
}

In QueryBuilder use qb.orderBy('categories.name', filter.orderDirection); Instead of column name from database. qb.orderBy('categories.my_name', filter.orderDirection);

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeORM: Cannot read property 'databaseName' of ...
TypeORM: Cannot read property 'databaseName' of undefined when trying to order-by field created after loadRelationCountAndMap.
Read more >
typeorm cannot read properties of undefined - You.com
Here's an example of a JavaScript TypeError: Cannot read property of undefined thrown when a property is attempted to be read on an...
Read more >
typeorm/typeorm - Gitter
... I have verified that the raw sql works, the problem is that I get the following error: "TypeError: Cannot read property 'databaseName'...
Read more >
加油毛子的独家号- 开发者头条
阅读加油毛子分享的TypeError: Cannot read property 'databaseName' of undefined,就在开发者头条。
Read more >
[Question] QueryBuilder - Issues with executing a query builder.
[Nest] 6940 - 2017-8-8 12:14:18 [ExceptionsHandler] Cannot read property 'databaseName' of undefined TypeError: Cannot read property ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found