강의

멘토링

커뮤니티

인프런 커뮤니티 질문&답변

허유정님의 프로필 이미지
허유정

작성한 질문수

탄탄한 백엔드 NestJS, 기초부터 심화까지

passport와 인증 전략 & Custom decorator

안녕하세요 선생님 궁금한게있어 질의드립니다!

작성

·

587

0

안녕하세요 강의 잘보고있습니다! typeorm으로 변경해서 하고있는데, 궁금한사항이 있어 질의드립니다.

findoneby 메서드를 이용해서 , cat 객체를 가져오려고하는데

ERROR [ExceptionsHandler] Cannot read properties of undefined (reading 'findOneBy') 이러한 예외가 발생합니다.. 왜그런거일까요 바쁘신데 죄송합니다 ㅠㅠ

 async jwtLogin(data: LoginRequestDto) {
    console.log(data);
    const login = await this.catsRepository.findOneBy({
      email: data.email,
    });

답변 1

0

안녕하세요 :)
답변 드립니다. 더 궁금하신 점 있으시면 언제든지 답글 달아주세요!

Cannot read properties of undefined (reading 'findOneBy') 는 LoginRequestDto 에 email 값이 undefined로 넘어 오거나 typeorm Entity를 잘못 만들었을 경우가 있습니다.

req.body가 잘 넘어가고 있는지 확인 부탁드립니다.

만약 문제 해결하셨다면 공유도 부탁드리고 싶습니다.

허유정님의 프로필 이미지
허유정

작성한 질문수

질문하기