{"id":506,"hash":"05f20e601e06c020d037893c48077d119d90751753979c59be85b3151fc7d36f","pattern":"TypeError: rxjs_1.lastValueFrom is not a function","full_message":"I am building an api using nestjs. After adding the typeorm and pg dependencies and adding the TypeOrmModule.forRoot({}) code in app.module.ts like shown below.\n\nimport { Module } from '@nestjs/common';\nimport { TypeOrmModule } from '@nestjs/typeorm';\nimport { AppController } from './app.controller';\nimport { AppService } from './app.service';\nimport { CoffeesModule } from './coffees/coffees.module';\n\n@Module({\n  imports: [CoffeesModule, TypeOrmModule.forRoot({\n    type: 'postgres',\n    host: 'localhost',\n    port: 5432,\n    username: 'postgres',\n    password: 'xxx',\n    database: 'postgres',\n    autoLoadEntities: true,\n    synchronize: true\n  })],\n  controllers: [AppController],\n  providers: [AppService],\n})\nexport class AppModule { }\n\nI get an error TypeError: rxjs_1.lastValueFrom is not a function with but no error when I exclude TypeOrmModule.forRoot({}).\n\nWhat could be the reason for the error ?","ecosystem":"npm","package_name":"postgresql","package_version":null,"solution":"If you're using Nest v8, RxJS version 7 is used, which no longer has a toPromise() method for Observables, so Nest uses the lastValueFrom method instead. If you're receiving this error, you probably need to update your rxjs dependency to >7.\n\nnpm i rxjs@^7\nyarn add rxjs@^7\npnpm i rxjs @^7\n\nPick your flavor of package manager and have at it.\n\nIn the last update of NestJS, when is used cli to initialization of project this error is throw.","confidence":0.95,"source":"stackoverflow","source_url":"https://stackoverflow.com/questions/68317383/typeerror-rxjs-1-lastvaluefrom-is-not-a-function","votes":46,"created_at":"2026-04-19T04:51:16.274770+00:00","updated_at":"2026-04-19T04:51:16.274770+00:00"}