Nest can't resolve dependencies of the MarkdownActivityAuthorizerInterceptor
Closed this issue · 2 comments
blueMountain007 commented
Describe the bug
A clear and concise description of what the bug is.
Have you read the Contributing Guidelines?
Yes
To Reproduce
Steps to reproduce the behavior:
- clone the small reproducible demo repository: https://github.com/xin-ze/nestjs_reproduction/tree/main
- select 'main' branch
- refer to README.md and execute the code, will encounter an error: nestjs cannot find the generated AuthorizerProviders
Expected behavior
This error disappears
code path: apps/content/src/app/markdown/markdown.module.ts
Desktop (please complete the following information):
- Node Version: 18.16.0
- Nestjs-query Version v5.0.0
TriPSs commented
Please follow the docs.
You need to change the module to look more like this:
@Module({
exports: [],
imports: [
NestjsQueryGraphQLModule.forFeature({
imports: [TypeOrmModule.forFeature([MarkdownActivity])],
services: [MarkdownActivityService],
resolvers: [
{
DTOClass: YourDTO,
EntityClass: MarkdownActivity,
},
],
}),
],
providers: [
MarkdownActivityResolver,
],
})
export class MarkdownModule {}
blueMountain007 commented
@TriPSs Thank you! I have one more question: do I have to declare a DTO class? There is no such concept in the demo code. After rewriting it like this, the error is still reported.
![image](https://private-user-images.githubusercontent.com/16400882/311425651-3f69425f-3826-4e8c-aafd-a0677628977e.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjAzMzE0ODMsIm5iZiI6MTcyMDMzMTE4MywicGF0aCI6Ii8xNjQwMDg4Mi8zMTE0MjU2NTEtM2Y2OTQyNWYtMzgyNi00ZThjLWFhZmQtYTA2Nzc2Mjg5NzdlLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA3MDclMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNzA3VDA1NDYyM1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTU5NTUxYzA4MjI2MDAyNjJjNjJlN2JhZmVhNmFiN2RjYzg5NjRhMzUzYTE2ZjgxY2IyZDFlYTI0MThkZTc5YjcmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.iZYb5udBWgzT48COhmKmtW9laamuk-AbxT6eL74n4Dw)
![image](https://private-user-images.githubusercontent.com/16400882/311425684-bebc99ed-6404-4bcb-b860-46845521a62e.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjAzMzE0ODMsIm5iZiI6MTcyMDMzMTE4MywicGF0aCI6Ii8xNjQwMDg4Mi8zMTE0MjU2ODQtYmViYzk5ZWQtNjQwNC00YmNiLWI4NjAtNDY4NDU1MjFhNjJlLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA3MDclMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNzA3VDA1NDYyM1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWQyMWZjMDVkMGNkMmJlZTNmZDA4NDAyNDQxODE3OTZiN2I0ZDUxMjdhODNhYmNhNTFlODQ3Y2Y0YTk5MTliOTgmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.mwYyvrbC4IMGnm8t81joWWIi7hWvEudeTKvLN6Om9yY)
The demo code has been updated and you should be able to reproduce it locally.