inflearn logo
강의

강의

N
챌린지

챌린지

멘토링

멘토링

N
클립

클립

로드맵

로드맵

지식공유

따라하며 배우는 노드, 리액트 시리즈 - 기본 강의

노드 리액트 기초 강의 #12 토큰 생성 with jsonwebtoken

아이디와 비밀번호를 잘못치면 서버가 다운됩니다

153

yuuni.cha

작성한 질문수 2

0

선생님 12강까지 강의를 듣고 따라해보고 있습니다.

id와 password를 예제대로 쳐서 포스트맨으로 send하면 success 라는 값을 받는데요

일부러 틀린 값을 보내면 postman에서 비밀번호가 틀렸다는 메시지를 받는데 서버쪽에서는 에러가 뜨면서 종료됩니다.

에러메시지는 다음과 같고요..

events.js:292
      throw er; // Unhandled 'error' event
      ^

Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client
    at ServerResponse.setHeader (_http_outgoing.js:558:11)
    at ServerResponse.header (C:\workspace\boiler-plate\node_modules\express\lib\response.js:771:10)
    at ServerResponse.append (C:\workspace\boiler-plate\node_modules\express\lib\response.js:732:15)
    at ServerResponse.res.cookie (C:\workspace\boiler-plate\node_modules\express\lib\response.js:857:8)
    at C:\workspace\boiler-plate\index.js:60:11
    at C:\workspace\boiler-plate\models\User.js:78:9
    at C:\workspace\boiler-plate\node_modules\mongoose\lib\model.js:4857:16
    at C:\workspace\boiler-plate\node_modules\mongoose\lib\helpers\promiseOrCallback.js:24:16
    at C:\workspace\boiler-plate\node_modules\mongoose\lib\model.js:4880:21
    at model.<anonymous> (C:\workspace\boiler-plate\node_modules\mongoose\lib\model.js:502:7)
    at C:\workspace\boiler-plate\node_modules\kareem\index.js:316:21
    at next (C:\workspace\boiler-plate\node_modules\kareem\index.js:210:27)
    at C:\workspace\boiler-plate\node_modules\kareem\index.js:183:9
    at C:\workspace\boiler-plate\node_modules\kareem\index.js:508:38
    at processTicksAndRejections (internal/process/task_queues.js:75:11)
Emitted 'error' event on Function instance at:
    at C:\workspace\boiler-plate\node_modules\mongoose\lib\model.js:4859:13
    at C:\workspace\boiler-plate\node_modules\mongoose\lib\helpers\promiseOrCallback.js:24:16
    [... lines matching original stack trace ...]
    at processTicksAndRejections (internal/process/task_queues.js:75:11) {
  code: 'ERR_HTTP_HEADERS_SENT'
}

에러에 대한 핸들링이 안되어 있는게 맞는건가요...

왜 서버가 꺼지는지 모르겠습니다..

nodejs react

답변 0

깃 이메일이랑 비번이 필요하다고 하네요

0

32

1

404 에러

0

101

1

34강 인증 체크에서 element 사용 때문에 에러나시는 분들 이렇게 하심 됩니다.

0

118

1

로그인, 로그아웃, 토근 작동 안 함

0

237

0

9강 오류 어떻게 해결하나요?

0

192

1

localhost 에서 연결을 거부했습니다.

0

1921

4

포스트맨에서 true가 안떠요

0

150

1

왜 안되나요

0

128

1

몽고db 연결 오류가 납니다 위에껀 입력한 코드, 아래껀 터미널이에요

0

242

1

로그아웃 401 에러(Unauthorized)

0

501

2

암호가 해싱되지 않고 입력값 그대로 db에 저장되는 문제

0

147

1

7강중에서

0

162

2

User.findByToken is not a function

0

210

1

루트 디렉토리

0

268

1

useState

0

560

1

프록시 잘 설정했는데도 404 오류 뜨는 분들

5

874

6

webpack 관련 에러 질문

0

218

1

리액트 관련 질문

0

271

1

14강 로그아웃 안됨

0

315

1

mongoDB 데이터 확인하는 법

0

407

1

postman 에러

0

289

1

선생님 리덕스를 사용하면 어떠한 부분이 좋은지 알 수 있을까요?

0

231

1

다음과 같은 에러들이 발생합니다.

0

269

1

14강 로그아웃 기능 구현시 postman에서 Cannot POST 오류가 뜹니다.

0

377

1