typeorm - InsertQueryBuilderCls is not a constructor

Viewed 29

I use an entity manager for a transaction making sure there are no nested commits in the procedure that I call like this, I set the search_path since my proc calls unprefixed entities internally

async savetournamentTransaction(tournament: any, matchId: string) {
    await this.connection.manager.transaction(async (tournamentEntityManager) => {
      const tournamentRepository = tournamentEntityManager.getRepository(tournament);
      await tournamentRepository.query(`SET LOCAL search_path to ${matchId}`);
      await tournamentRepository.save(tournament);
      await tournamentRepository.query(
        `CALL fillOrganizationScheduleTable($1,${tournament.tournament_id});`,
        [matchId],
      );
    });
  }
}

However, typeorm gives me this error that I can't really comprehend:

[Nest] 790  - 09/16/2022, 4:40:43 PM   ERROR [ExceptionsHandler] InsertQueryBuilderCls is not a constructor
TypeError: InsertQueryBuilderCls is not a constructor
    at SelectQueryBuilder.insert (/mypath/desktop/prj/volleyball-organization/src/query-builder/QueryBuilder.ts:200:16)
    at SubjectExecutor.executeInsertOperations (/mypath/desktop/prj/volleyball-organization/src/persistence/SubjectExecutor.ts:430:26)
    at SubjectExecutor.execute (/mypath/desktop/prj/volleyball-organization/src/persistence/SubjectExecutor.ts:137:20)
    at EntityPersistExecutor.execute (/mypath/desktop/prj/volleyball-organization/src/persistence/EntityPersistExecutor.ts:194:36)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at /mypath/desktop/prj/volleyball-organization/src/tournaments/tournaments.service.ts:155:13
    at EntityManager.transaction (/mypath/desktop/prj/volleyball-organization/src/entity-manager/EntityManager.ts:151:28)
    at tournamentsService.savetournamentTransaction (/mypath/desktop/prj/volleyball-organization/src/tournaments/tournaments.service.ts:152:9)
    at tournamentsService.createtournament (/mypath/desktop/prj/volleyball-organization/src/tournaments/tournaments.service.ts:113:9)
    at /mypath/desktop/prj/volleyball-organization/node_modules/@nestjs/core/router/router-execution-context.js:46:28  
  

I can't really find anything similar to this error, what might be the issue be, and how may I resolve it?

0 Answers
Related