작성
·
133
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'
}
에러에 대한 핸들링이 안되어 있는게 맞는건가요...
왜 서버가 꺼지는지 모르겠습니다..
답변