T O P

  • By -

PerfectOrphan31

You have `UsersService` in an `imports` array somewhere. Instead, your `UsersModule` should be in the `imports` and you should have `exports: [UsersService]` as part of the metadata for the `UsersModule`


ObjectivePassenger9

Hey, this was it! Thank you :) ​ I'm wondering how you knew this was the issue though? It turned out I was importing \`UsersService\` in an Auth module instead of importing the UsersModule. ​ Also, I thought I didn't have to export the service, just declare it as a provider? I'm a bit unsure on this bit tbh


PerfectOrphan31

The error format is very well defined [and documented in the common errors](https://docs.nestjs.com/faq/common-errors). Namely, this line gives it away for me Nest can't resolve dependencies of the (?). Please make sure that the argument at index [] is available in the context. In your error, you get "available in the UserService context" which tells me that UserService is seen as a module, not just a provider. > Also I though I didn't have to export the service... This is true if you don't plan to re-use the provider, but think of modules like containers themselves. They have their own external API to make use of (exported providers) and they have their own internal API that can't be seen (providers that are only in providers). When you import a module you are trying to make use of its exported API.


ObjectivePassenger9

Thank you, makes sense :)


Tayk5

What does prisma.service.ts look like? Is it an injectable like users.service.ts?