denoland / deno

A modern runtime for JavaScript and TypeScript.
https://deno.com
MIT License
98.16k stars 5.4k forks source link

NestJS cannot resolve ModuleRef dependency after TerminusModule is added #26427

Open lucassusanto opened 1 month ago

lucassusanto commented 1 month ago

Problem

How To Reproduce

  1. Clone the minimal reproducible project example
    git clone https://github.com/lucassusanto/nestjs-deno-terminus-issue
  2. Install the dependencies
    deno install
  3. Run the application
    deno run --allow-env --allow-net --allow-read src/main.ts
  4. NestJS won't start

    [Nest] 13408  - 10/20/2024, 3:06:53 PM   ERROR [ExceptionHandler] Nest can't resolve dependencies of the TypeOrmHealthIndicator (?). Please make sure that the argument ModuleRef at index [0] is available in the TerminusModule context.
    
    Potential solutions:
    - Is TerminusModule a valid NestJS module?
    - If ModuleRef is a provider, is it part of the current TerminusModule?
    - If ModuleRef is exported from a separate @Module, is that module imported within TerminusModule?
     @Module({
       imports: [ /* the Module containing ModuleRef */ ]
     })

Expected Result

Additional Context

lucassusanto commented 1 month ago

It also happens while I'm using pure deno—not node compat. Here is the minimal reproducible project: https://github.com/lucassusanto/nestjs-deno-terminus-issue/tree/deno-starter

smartmeta commented 6 hours ago

I'm facing the same issue on

deno 2.1.1 (stable, release, aarch64-apple-darwin) v8 13.0.245.12-rusty typescript 5.6.2