Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cryptic Error message when exported Component is not listed in Components collection #479

Closed
mcMickJuice opened this issue Mar 6, 2018 · 3 comments

Comments

@mcMickJuice
Copy link

I'm submitting a...


[ ] Regression 
[ ] Bug report
[ / ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.

Current behavior

If I omit an exported component from the components collection of a module but include it in the exports collection, I get a cryptic error when importing it into a component into a separate module.

Nest can't resolve dependencies of the OtherController (?). Please verify whether [0] argument
 is available in the current context.

Expected behavior

The error on boot should say something along the lines of "you have included a Component in the 'exports' collection but did not register it in the 'components' collection. This will cause DI to break. Please list all exported components in the 'components' AND 'exports' collection`

Minimal reproduction of the problem with instructions

https://github.com/mcMickJuice/typescript-starter

What is the motivation / use case for changing the behavior?

Better error messaging and less time wasted around incorrect component registration

Environment

    "@nestjs/common": "^4.5.9",
    "@nestjs/core": "^4.5.10",
    "@nestjs/microservices": "^4.5.8",
    "@nestjs/testing": "^4.5.5",
    "@nestjs/websockets": "^4.5.8",
@kamilmysliwiec
Copy link
Member

Thanks for reporting @mcMickJuice !

@kamilmysliwiec
Copy link
Member

Added in v4.6.6 🙂

@lock
Copy link

lock bot commented Sep 25, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Sep 25, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants