nestjs/mongoose

rxjs 6 is incompatible, but listed as valid peer dependency

Closed this issue · 1 comments

Is there an existing issue for this?

  • I have searched the existing issues

Current behavior

In the package.json, rxjs v6 is listed as a valid peer dependency.

However, when you use @nestjs/mongoose@9.1.0 with rxjs@6.6.7, it will throw:

TypeError: (0 , rxjs_1.lastValueFrom) is not a function

Problem: The MongooseCoreModule uses lastValueFrom which was only introduced with rxjs v7 (and replaces toPromise).

Minimum reproduction code

https://github.com/kiwikern/nest-mongoose-bug-example/

Steps to reproduce

  1. npm i
  2. npm start
  3. -> Error in log

Expected behavior

Either:
a) Compatibility with rxjs v6 by using toPromise instead of lastValueFrom.
b) Removing rxjs v6 from the listed peer dependencies

Package version

9.1.0

mongoose version

6.3.5

NestJS version

7.6.18

Node.js version

14.18.1

In which operating systems have you tested?

  • macOS
  • Windows
  • Linux

Other

No response

Fixed. Thanks for reporting!