NestJS: Cannot determine a type for the guard
NestJSのGuard/Interceptorでエラーが発生した場合の対処法
概要
NestJSでGuardやInterceptorが正しく動作しない場合のエラーと解決策です。
エラーメッセージ
Error: Cannot determine a type for the "AuthGuard" argument at index [0]
UnauthorizedException: Unauthorized
ForbiddenException: Forbidden resource
解決策
1. 基本的なGuardの実装
| |
2. Guardの適用
| |
3. JWTを使用したAuthGuard
| |
4. RolesGuard
| |
5. Interceptorの実装
| |
6. レスポンス変換Interceptor
| |
7. エラーハンドリング
| |
関連エラー
関連エラー
この記事は役に立ちましたか?