Skip to content

Nest cannot export a provider/module that is not a part of the currently processed module (MikroOrmCoreModule). Please verify whether the exported MongoMikroORM is available in this particular context. #179

@snigdha920

Description

@snigdha920

Describe the bug
A clear and concise description of what the bug is.

When starting my nestjs application that uses both postgres and mongodb depending on the configuration provided, I see this error since v6.0.0:

Nest cannot export a provider/module that is not a part of the currently processed module (MikroOrmCoreModule). Please verify whether the exported MongoMikroORM is available in this particular context.

Stack trace

[Nest] 12276  - 05/21/2024, 2:26:56 PM     LOG [NestFactory] Starting Nest application...
[Nest] 12276  - 05/21/2024, 2:26:56 PM   ERROR [ExceptionHandler] Nest cannot export a provider/module that is not a part of the currently processed module (MikroOrmCoreModule). Please verify whether the exported MongoMikroORM is available in this particular context.

Possible Solutions:
- Is MongoMikroORM part of the relevant providers/imports within MikroOrmCoreModule?

Error: Nest cannot export a provider/module that is not a part of the currently processed module (MikroOrmCoreModule). Please verify whether the exported MongoMikroORM is available in this particular context.

Possible Solutions:
- Is MongoMikroORM part of the relevant providers/imports within MikroOrmCoreModule?

    at Module.validateExportedProvider (/Users/snigdhasingh/Development/nestjs-example-app/node_modules/@nestjs/core/injector/module.js:308:19)
    at addExportedUnit (/Users/snigdhasingh/Development/nestjs-example-app/node_modules/@nestjs/core/injector/module.js:276:67)
    at Module.addExportedProvider (/Users/snigdhasingh/Development/nestjs-example-app/node_modules/@nestjs/core/injector/module.js:287:9)
    at NestContainer.addExportedProvider (/Users/snigdhasingh/Development/nestjs-example-app/node_modules/@nestjs/core/injector/container.js:168:19)
    at DependenciesScanner.insertExportedProvider (/Users/snigdhasingh/Development/nestjs-example-app/node_modules/@nestjs/core/scanner.js:291:24)
    at /Users/snigdhasingh/Development/nestjs-example-app/node_modules/@nestjs/core/scanner.js:148:50
    at Array.forEach (<anonymous>)
    at DependenciesScanner.reflectExports (/Users/snigdhasingh/Development/nestjs-example-app/node_modules/@nestjs/core/scanner.js:148:17)
    at DependenciesScanner.scanModulesForDependencies (/Users/snigdhasingh/Development/nestjs-example-app/node_modules/@nestjs/core/scanner.js:101:18)
    at async DependenciesScanner.scan (/Users/snigdhasingh/Development/nestjs-example-app/node_modules/@nestjs/core/scanner.js:31:9)

To Reproduce
Reproduction repo: https://github.com/snigdha920/nestjs-example-app

Expected behavior
A clear and concise description of what you expected to happen.

The app should start, like it did with v5.2.3

Versions
All the versions can be found in the reproduction repo.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions