데이터 베이스 생성 후 postman의 get products에서 send를 누른 뒤 오류
784
작성자 없음
작성한 질문수 0
안녕하세요 그랩님! 강의 잘 듣고 있습니다.
postman에서 create product에서 제품 정보들을 입력하고, DB Browser for SQLite에 데이터가 아래와 같이 입력된 것을 확인했습니다.

이후 포스트맨에서 get products로 들어가 send를 누르니 아래와 같이 '모든 필드를 입력해주세요' 라는 문구가 뜹니다.

vscode에서 name, description,price,seller 이 네가지가 notNull로 설정되어 있어서
이 네가지 값이 잘 입력되지 않았을 때 해당 에러 문구가 뜨는 것일 텐데
소스 코드를 보면서 다른 점을 찾아봐도 딱히 다른점을 모르겠습니다... (제 눈의 문제인지...ㅠㅠ)
아래는 제가 작성한 코드입니다.
<product.js>

<server.js>


vscode 터미널에 뜨는 에러 코드는 아래와 같습니다.
에러 코드에도 보면 첫줄에 'notNull Violation'이라고 되어 있어서 해당 조건을 어겼기 때문인 것 같은데...
데이터 베이스에 값들이 잘 들어가 있는 거 같은데 뭐가 잘못된 걸까요...
한 번 봐주시고 혹시 제가 놓친 부분이 있거나 좋은 방법이 있다면 답변해주시면 감사하겠습니다..!!
ValidationError [SequelizeValidationError]: notNull Violation: Product.name cannot be null,
notNull Violation: Product.price cannot be null,
notNull Violation: Product.seller cannot be null,
notNull Violation: Product.description cannot be null
at InstanceValidator._validate (/Users/jade/Desktop/grab-market-server/node_modules/sequelize/lib/instance-validator.js:50:13)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async InstanceValidator._validateAndRunHooks (/Users/jade/Desktop/grab-market-server/node_modules/sequelize/lib/instance-validator.js:60:7)
at async InstanceValidator.validate (/Users/jade/Desktop/grab-market-server/node_modules/sequelize/lib/instance-validator.js:54:12)
at async model.save (/Users/jade/Desktop/grab-market-server/node_modules/sequelize/lib/model.js:2368:7)
at async Function.create (/Users/jade/Desktop/grab-market-server/node_modules/sequelize/lib/model.js:1344:12) {
errors: [
ValidationErrorItem {
message: 'Product.name cannot be null',
type: 'notNull Violation',
path: 'name',
value: null,
origin: 'CORE',
instance: [Product],
validatorKey: 'is_null',
validatorName: null,
validatorArgs: []
},
ValidationErrorItem {
message: 'Product.price cannot be null',
type: 'notNull Violation',
path: 'price',
value: null,
origin: 'CORE',
instance: [Product],
validatorKey: 'is_null',
validatorName: null,
validatorArgs: []
},
ValidationErrorItem {
message: 'Product.seller cannot be null',
type: 'notNull Violation',
path: 'seller',
value: null,
origin: 'CORE',
instance: [Product],
validatorKey: 'is_null',
validatorName: null,
validatorArgs: []
},
ValidationErrorItem {
message: 'Product.description cannot be null',
type: 'notNull Violation',
path: 'description',
value: null,
origin: 'CORE',
instance: [Product],
validatorKey: 'is_null',
validatorName: null,
validatorArgs: []
}
]
}
node:internal/errors:465
ErrorCaptureStackTrace(err);
^
Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client
at new NodeError (node:internal/errors:372:5)
at ServerResponse.setHeader (node:_http_outgoing:576:11)
at ServerResponse.header (/Users/jade/Desktop/grab-market-server/node_modules/express/lib/response.js:794:10)
at ServerResponse.send (/Users/jade/Desktop/grab-market-server/node_modules/express/lib/response.js:174:12)
at /Users/jade/Desktop/grab-market-server/server.js:44:11
at processTicksAndRejections (node:internal/process/task_queues:96:5) {
code: 'ERR_HTTP_HEADERS_SENT'
}
답변 2
[해결]그랩님 답변 주세요.
0
190
2
그랩님의 답변을 기다립니다/102강 전반적인 에러
0
162
2
[그랩님께]101강 안드로이드 에러들(Key prop)해결방법 궁금합니다.
0
139
2
[재질문][그랩님 답변 부탁드립니다]101강
0
162
2
[그랩님 답변 부탁드립니다]101강 Axios 에러와 502 Bad Gateway 질문
0
119
2
Ngrok 설치 후 forwarding Url 에러
0
145
2
[그랩님께,Ngrok 악성코드 인식 해결방법]질문 드립니다.
0
251
2
Ngrok 설치 후 forwarding Url로 연결 불가
0
157
1
그랩님,[꼭] 답변 부탁드립니다.
0
76
1
[꼭][[꼭] 그랩님, 답변 부탁드립니다], Failed to load resource: the server responded with a status of 404 (Not Found) 상품 상세 페이지 질문입니다.
0
162
1
6강/7강 수업
0
56
1
그랩님, 상품 상세 페이지 에러와 의문점 질문드립니다.
0
105
2
그랩님, 해결되지 않은 에러 메시지 [꼭] 답변 부탁 드립니다.
0
148
2
[재 질문]Cannot read properties of undefined (reading 'map') TypeError: Cannot read properties of undefined (reading 'map') 에러 해결 어떻게 하나요?
0
94
1
Cannot read properties of undefined (reading 'map') TypeError: Cannot read properties of undefined (reading 'map') 에러 해결 어떻게 하나요?
0
134
2
일반적인 css 꾸미기에서 width와 height의 값?
0
98
2
Windows에서의 업로드 후 홈화면 상품이미지 오류 해결방법
0
204
1
그랩마켓 웹화면 구현하기 -2 질문입니다.
0
127
1
react에 반영이 되지 않습니다.
0
250
1
터미널 npm install -g create-react-app 작성 후 오류
0
430
1
create-react-app my app 실행 시 에러
0
358
2
포스트맨 질문
0
105
1
<꼭 답변 부탁 드립니다>그랩선생님, [컴포넌트 사용하기] 강의에서 질문 있습니다.
0
269
2
그랩선생님, 질문 답변 부탁 드립니다.vscode에서 npm install -g create-react-app 입력 후 에러 입니다.
0
492
2





