Nest can't resolve dependencies of the JwtAuthenticationGuard after upgrade 8.1.0 to 8.1.1
See original GitHub issueDid you read the migration guide?
- I have read the whole migration guide
Is there an existing issue that is already proposing this?
- I have searched the existing issues
Potential Commit/PR that introduced the regression
No response
Versions
No response
Describe the regression
After upgrade nest, in special @nestjs/passport
, it started to throw an exception. Going back to 8.1.0 it works again.
The error
[Nest] 63736 - 14/02/2022, 17:05:19 ERROR [ExceptionHandler] Nest can't resolve dependencies of the JwtAuthenticationGuard. Please make sure that the "options" property is available in the current context.
Potential solutions:
- If AuthModuleOptions is a provider, is it part of the current EmailScheduleModule?
- If AuthModuleOptions is exported from a separate @Module, is that module imported within EmailScheduleModule?
@Module({
imports: [ /* the Module containing AuthModuleOptions */ ]
})
Error: Nest can't resolve dependencies of the JwtAuthenticationGuard. Please make sure that the "options" property is available in the current context.
Potential solutions:
- If AuthModuleOptions is a provider, is it part of the current EmailScheduleModule?
- If AuthModuleOptions is exported from a separate @Module, is that module imported within EmailScheduleModule?
@Module({
imports: [ /* the Module containing AuthModuleOptions */ ]
})
at Injector.lookupComponentInParentModules (/Users/rvieceli/Projects/study/nestjs/wanago.io-nestjs/node_modules/@nestjs/core/injector/injector.js:202:19)
at Injector.resolveComponentInstance (/Users/rvieceli/Projects/study/nestjs/wanago.io-nestjs/node_modules/@nestjs/core/injector/injector.js:157:33)
at /Users/rvieceli/Projects/study/nestjs/wanago.io-nestjs/node_modules/@nestjs/core/injector/injector.js:260:38
at async Promise.all (index 0)
at Injector.resolveProperties (/Users/rvieceli/Projects/study/nestjs/wanago.io-nestjs/node_modules/@nestjs/core/injector/injector.js:251:27)
at callback (/Users/rvieceli/Projects/study/nestjs/wanago.io-nestjs/node_modules/@nestjs/core/injector/injector.js:47:32)
at Injector.resolveConstructorParams (/Users/rvieceli/Projects/study/nestjs/wanago.io-nestjs/node_modules/@nestjs/core/injector/injector.js:124:24)
at Injector.loadInstance (/Users/rvieceli/Projects/study/nestjs/wanago.io-nestjs/node_modules/@nestjs/core/injector/injector.js:52:9)
at Injector.loadInjectable (/Users/rvieceli/Projects/study/nestjs/wanago.io-nestjs/node_modules/@nestjs/core/injector/injector.js:70:9)
at async Promise.all (index 0)
Minimum reproduction code
Look at my project https://github.com/rvieceli/wanago.io-nestjs
Expected behavior
It doesn’t depend on AuthModuleOptions
Other
[System Information]
OS Version : macOS Big Sur
NodeJS Version : v16.14.0
NPM Version : 8.3.1
[Nest CLI]
Nest CLI Version : 8.2.0
[Nest Platform Information]
platform-express version : 8.3.0
elasticsearch version : 8.0.0
schematics version : 8.0.5
passport version : 8.1.1
schedule version : 1.0.2
typeorm version : 8.0.3
testing version : 8.2.6
common version : 8.3.0
config version : 1.2.0
core version : 8.3.0
cqrs version : 8.0.2
jwt version : 8.0.0
cli version : 8.2.0
Issue Analytics
- State:
- Created 2 years ago
- Reactions:7
- Comments:9 (5 by maintainers)
Top Results From Across the Web
Nest can't resolve dependencies of the AuthGuard (Guard ...
I want use this Guard in controllers to check authentication. I've this error: Nest can't resolve dependencies of the AuthGuard (?, +).
Read more >[8.1.1] - Nest can't resolve dependencies of the JwtAuthGuard ...
error: Nest can't resolve dependencies of the JwtAuthGuard. Please make sure that the "options" property is available in the current context.
Read more >Authentication | NestJS - A progressive Node.js framework
Authenticate a user by verifying their "credentials" (such as username/password, JSON Web Token (JWT), or identity token from an Identity Provider); Manage ...
Read more >Handling authentication in GraphQL – Part 2: JWT - Pusher Blog
These are all the dependencies for our GraphQL server and the authentication system. We'll go over each of them as we begin to...
Read more >NestJs JWT - Access Tokens & Refresh Tokens - Ultimate Guide
In this video, I will be building a complete authentication module with logout and refresh functionality. I will also show how you can...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@cleytoncoro if you’d read the above comments in the issue, and the linked PR, you’d realize this already has a fix, and there’s solutions in the thread already. Kamil will most likely publish a patch or minor update for this once the PR is merged.
Only if
PassportModule.register()
with options you want to have used (like user property )AuthService
Otherwise, it shouldn’t really be necessary, but it is at the moment because of the change