webpacknestjstypeormmonoreponx.dev

No metadata for "LookupType" was found. EntityMetadataNotFoundError: No metadata for "LookupType" was found


I am trying to create a backend using NestJS with nx mono repo and I am getting this error No metadata for "LookupType" was found. EntityMetadataNotFoundError: No metadata for "LookupType" was found.

error detail: EntityMetadataNotFoundError: No metadata for "LookupType" was found. at DataSource.getMetadata (/Users/ramazan/Source/crossborder-codebase/src/data-source/DataSource.ts:438:30) at Repository.get metadata [as metadata] (/Users/ramazan/Source/crossborder-codebase/src/repository/Repository.ts:53:40) at Repository.findOne (/Users/ramazan/Source/crossborder-codebase/src/repository/Repository.ts:577:42) at PostgreSqlGenericRepository. (/Users/ramazan/Source/crossborder-codebase/dist/apps/api/webpack:/src/frameworks/data-services/postgresql/postgresql-generic-repository.ts:55:43) at Generator.next () at /Users/ramazan/Source/crossborder-codebase/node_modules/tslib/tslib.js:167:75 at new Promise () at Object.__awaiter (/Users/ramazan/Source/crossborder-codebase/node_modules/tslib/tslib.js:163:16) at PostgreSqlGenericRepository.get (/Users/ramazan/Source/crossborder-codebase/dist/apps/api/main.js:2476:24) at LookupTypeUseCases. (/Users/ramazan/Source/crossborder-codebase/dist/apps/api/webpack:/src/use-cases/lookup-type/lookuptype.use-case.ts:38:53)

project directory structure with nx(mono repo) enter image description here

configuration.module.ts

TypeOrmModule.forRootAsync({
  imports: [ConfigModule],
  inject: [ConfigService],
  useFactory: (configService: ConfigService) => ({
    type: 'postgres',
    host: configService.get('POSTGRES_HOST'),
    port: configService.get('POSTGRES_PORT'),
    username: configService.get('POSTGRES_USER'),
    password: configService.get('POSTGRES_PASSWORD'),
    database: configService.get('POSTGRES_DB'),
    entities: [__dirname + '/../**/**/*.entity.{ts,js}'],
    synchronize: true,
  }),

Solution

  • I solved the problem as changed build config "executor": "@nrwl/js:tsc" in project.app.json