codestates / codestates/Subllet
[ERR] unable to verify the first certificate
- Dominant language
- JavaScript
- Stars
- 0
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
### 어떤 에러인가요?
- Jest로 확인 시 unable to verify the first certificate라는 오류가 발생했습니다.
### 에러 메시지
```shell
$ unable to verify the first certificate
```
### 에러 핸들링 방법
- 현재 자체적인 https의 인증서를 사용하기 때문이라고 판단해 http로 수정을 했더니 오류가 해결되었습니다. 로컬에서 API 부분을 test할 때는 http로 해야할 것으로 판단되나 다른 해결책이 있는지 확인해볼 생각입니다.
```js
// const HTTPS_PORT = process.env.HTTPS_PORT || 4000;
const port = 4000;
app.listen(port, () => {
console.log(`[RUN] StatesAirline Server... | http://localhost:${port}`);
});
// let server;
// if (fs.existsSync("./key.pem") && fs.existsSync("./cert.pem")) {
// const privateKey = fs.readFileSync(__dirname + "/key.pem", "utf8");
// const certificate = fs.readFileSync(__dirname + "/cert.pem", "utf8");
// const credentials = { key: privateKey, cert: certificate };
// server = https.createServer(credentials, app);
// server.listen(HTTPS_PORT, () => console.log("server runnning"));
// } else {
// server = app.listen(HTTPS_PORT);
// }
module.exports = app;
```
### 에러 핸들링을 위해 참고한 레퍼런스 링크
https://stackoverflow.com/questions/31673587/error-unable-to-verify-the-first-certificate-in-nodejs
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.