-
카테고리
-
세부 분야
백엔드
-
해결 여부
미해결
TypeError: Cannot read property 'passport' of undefined
21.09.27 23:14 작성 조회수 572
0
강사님 소스랑 똑같이 따라쳤는데
제목과 같은 에러가 납니다.
TypeError: Cannot read property 'passport' of undefined
at SessionStrategy.authenticate (D:\z3-develope\slack-socket\backend\node_modules\passport\lib\strategies\session.js:51:18)
at attempt (D:\z3-develope\slack-socket\backend\node_modules\passport\lib\middleware\authenticate.js:360:16)
at authenticate (D:\z3-develope\slack-socket\backend\node_modules\passport\lib\middleware\authenticate.js:361:7)
at Layer.handle [as handle_request] (D:\z3-develope\slack-socket\backend\node_modules\express\lib\router\layer.js:95:5)
at trim_prefix (D:\z3-develope\slack-socket\backend\node_modules\express\lib\router\index.js:317:13)
at D:\z3-develope\slack-socket\backend\node_modules\express\lib\router\index.js:284:7
at Function.process_params (D:\z3-develope\slack-socket\backend\node_modules\express\lib\router\index.js:335:12)
at next (D:\z3-develope\slack-socket\backend\node_modules\express\lib\router\index.js:275:10)
at initialize (D:\z3-develope\slack-socket\backend\node_modules\passport\lib\middleware\initialize.js:66:5)
at Layer.handle [as handle_request] (D:\z3-develope\slack-socket\backend\node_modules\express\lib\router\layer.js:95:5)
패스포트를 못읽어오는거 같은데
네스트 버그인가요? 저와같은 에러 나오시는분 계신가요?
이게 처음부터 이 에러가 아니라 아마, 저 에러로 인해서
UnhandledPromiseRejectionWarning: TypeError: exception.getStatus is not a function
at HttpExceptionFilter.catch (D:\z3-develope\slack-socket\backend\dist\main.js:2211:34)
at ExceptionsHandler.invokeCustomFilters (D:\z3-develope\slack-socket\backend\node_modules\@nestjs\core\exceptions\exceptions-handler.js:33:26)
at ExceptionsHandler.next (D:\z3-develope\slack-socket\backend\node_modules\@nestjs\core\exceptions\exceptions-handler.js:13:18)
at D:\z3-develope\slack-socket\backend\node_modules\@nestjs\core\router\router-proxy.js:24:35
at Layer.handle_error (D:\z3-develope\slack-socket\backend\node_modules\express\lib\router\layer.js:71:5)
at trim_prefix (D:\z3-develope\slack-socket\backend\node_modules\express\lib\router\index.js:315:13)
at D:\z3-develope\slack-socket\backend\node_modules\express\lib\router\index.js:284:7
at Function.process_params (D:\z3-develope\slack-socket\backend\node_modules\express\lib\router\index.js:335:12)
at next (D:\z3-develope\slack-socket\backend\node_modules\express\lib\router\index.js:275:10)
at Layer.handle_error (D:\z3-develope\slack-socket\backend\node_modules\express\lib\router\layer.js:67:12)
이 에러가 나는데 에러이셉션에서 에러를 가로채올때
이 에러같은 경우에는 스테이스를 가져올 수 없기때문에 바로 위 에러가 먼저나오고, 이셉션에서 에러 찍으면 제일 위에 있는 에러가 나옵니다.
내일 다시 해볼생각이긴 하지만
혹시 먼저 경험해보신분 계시면 해결방법 공유 부탁드립니다.
답변을 작성해보세요.
0
특별한 까치
질문자2022.02.02
main.ts에 아래 추가해주고 해결했습니다.
세션이 없어서 난 에러인데.. 신기하네요 다른분들은 괜찮았나요..??
조현영
지식공유자2022.02.02
0
특별한 까치
질문자2021.09.28
음 아직 화면이 없어서 포스트맨으로 보냈는데
에러메세지로 보아서는 패스포트를 못읽어오는게 문제인것같기는 하지만...
완벽하게 따라치지 못했을 가능성도 충분하니 좀 더 알아보겠습니다.
0
특별한 까치
질문자2021.09.28
이구요,
이런식으로 임포트했습니다.
main.ts 전체코드는
입니다.
package.json
조현영
지식공유자2021.09.28
저게 로그인 시 발생하는 에러인가요? 로그인 라우터나 로컬가드 로컬시리얼라이저 등에서 오타가 난 것 같습니다. 모듈에서 프로바이더를 빠뜨리셨을 수도 있고요
0
답변 4