TypeError: Class extends value undefined is not a function or null

I am getting the following error when trying to create these entities. TypeError: Class extends value undefined is not a function or null I am assuming this has something to do with circular...

TypeORM does not create tables, columns etc

I have set up a system with typeorm (https://github.com/typeorm/typeorm) and NestJs (https://github.com/nestjs/nest), but TypeORM isn't creating the tables or columns. My setup is like...

TypeORM: [364] ERROR: missing FROM-clause entry for table "userorganisation" at character 401

I just hit a pretty interesting problem when using TypeORM and joining tables that I've set up for a Postgres database. I figured it out but thought I'd post the info here for anyone else that had...

How to specify ormconfig.ts for TypeORM?

I have created a sample TypeORM project using the TypeORM CLI which has ormconfig.json by default: { "type": "postgres", "host": "localhost", "port": 5432, "username": "postgres", ...

TypeORM - run specific migration

I know typeorm migration:run to run all migration files, but some time I want run a file like insert file, or a modified file. But i can't find any doc for that. How to do that thanks.

How to load relations with tree entity with typeorm?

I have a Role Entity and a Route Entity which is tree structure, and they're ManyToMany relation. Now I want to retrive all the roles via RoleRepository.find({relations: ['routes']}), which will...

TypeORM problem saving entity with cascade true

I m using NestJS with TypeORM and I m trying to save a user conversation with messages. I set the messages field on the conversation entity to *cascade: true*. But When I try this code: const...

How To use service methods inside typeorm transactions

I have read about transactions in typeorm. @Transaction() save(user: User, @TransactionRepository(User) userRepository: Repository<User>) { return userRepository.save(user); } I have a...

Jest test passed but get Error: connect ECONNREFUSED 127.0.0.1:80 at the end

I'm using node with TypeScript on my back end and Jest and Supertest as my test framework on my back end. When I'm trying to test I have the result pass but I get an error at the end. Here's the...

How to serialize a nest js response with class-transformer while getting data with Typegoose?

I have been trying to work through the NestJs example for the Serialization Section for Mongodb using Typegoose using the class-transformer library. The example given at...

Cannot read property 'context' of undefined - GraphQL

I am using Typescript, Express, TypeORM, GraphQL and TypeGraphQL to build a small app that allows the user to login. However, when I hit my test query bye on the GraphQL playground, I get: Cannot...

TypeORM throws QueryFailedError Table already exists on MySQL when synchronize is true

I am using NestJS, TypeORM, and MySQL to build a web application. I am using a .env file to pass in some environment variables for connecting to my local database. Synchronize is set to...

Typeorm: Execute raw query with parameters

I'm trying to execute raw query in typeorm with parameters I tried following queries: insert into data(id, name, gender) values(?, ?,?) insert into data(id, name, gender) values($1, $2, $3) insert...

Property 'findAncestors' does not exist on type 'Repository '

Hi i have a problem with my typeorm code. I followed the example from here: https://github.com/typeorm/typeorm/blob/master/docs/tree-entities.md#materialized-path-aka-path-enumeration. So my...

How can I user configService in super()?

I have a question about setting environmental variables. In official document, it says using ConfigModule in this case, but my case is a exception case. Because I would like to use it in super()...

RepositoryNotFoundError: No repository for "User" was found. Looks like this entity is not registered in current "default" connection? Typeorm

I am having a fun issue trying to get TypeOrm to work in my nestjs project. I have the below code to configure my project, yes everything loads, and yes I am able to connect to my database. import...

typeorm "CREATE DATABASE" migration

I need to create database before connection and work with db. I'm using nest.js typeorm, provided all configurations. When I start my application it says "Unable to connect to the database....

Computed column with alias is not mapping into TypeORM Entity

I'm trying to get data from a table of a MySQL database using TypeORM in my Express.js project. I'm using QueryBuilder to get data. My implementation: const result = await...

How can I bulk upsert entities with typeorm?

I'm trying to figure out how to make upsert SQL working with typeorm entities (not using querybuilder!!) const items = Items[] //Items are the entity which extends BaseEntity await...

typeORM No changes in database schema were found - cannot generate a migration. To create a new empty migration use "typeorm migration:create" command

I'm doing a course where we are using express-node postgres and react (with typescript) and typeORM. Everything has worked well so far, but I'm facing an issue with typeORM and I don't know what...

TypeORM: Relations eager on tree entity

I have a Tree entity like this: @Entity('structures') @Tree('closure-table') export class StructureEntity extends AbstractEntity<StructureDto> { @Column() name: string; @TreeParent({...

How to use transactions in Typeorm with typeorm-transactional-cls-hooked

I can't get everything to run within the same transaction. I have the following code: export class TestService { repository: any; constructor( @Inject(TENANT_CONNECTION) private connection) ...

How to use Redis as a store for Express Session NestJS

I'm creating an API using NestJS and was trying to set up a session store for my express session but I get an error from this line. I did use express-session with Redis on a new project I created...

Can't mock Paginate function in jest unit tests

I am trying to mock my service's findAll function. For this I either need to mock the repository function findAndCount myEntityRepository or the paginate function of of nestjs-typeorm-paginate...

Unable to inject a chosen custom repository in a module

Current behavior I am attempting to apply SOLID principles, and therefore decoupling my service from TypeOrm. The benefit is that I could use an InMemoryRepository for test purposes, and...

Error: Cannot query across one-to-many for property TypeORM

I have implemented one to one and one to many relations between tables. Main table Business @Entity() export class Business { @PrimaryGeneratedColumn() readonly id: number; @Column({...

How to remove deleted typeorm migration files from migration list

ran typeorm migration:generate -n <name>, but generated migration files did not run due to some issues, deleted the generated file and created another migration file and try to run the migration,...

NestJS lazy loading a module importing TypeORM doesn't register "Connection" providers

I have a DatabaseModule that imports TypeORM and starts the db connections (cf. database.module.ts). I use that module on a crud module and everything works fine while registring the modules the...

Error when running database migrations with NestJS, TypeORM and Docker

Using NestJS, docker-compose and Postgres on Ubuntu 20.4 Trying my first database migration with this app: npx typeorm migration:create -n mushroomRefactor npm run build npx typeorm...

NestJS & TypeORM Relations : Failed to fetch ManyToOne / OneToMany relation; user Object empty, I cannot fetch video and its corresponding uploader

Does no one know why it's not working? :`( I am building a youtube clone with NestJS and VueJS. I am struggling with fetching all videos with the the user who uploaded it. So, it's basically a...