[Javascript] Error: Malformed UTF-8 data
2023. 4. 12. 23:29
개발/Error note
리액트에서 cryptojs 사용중 Malformed UTF-8 data 오류가 발생했다. 나의 경우엔 백엔드와 공유한 키를 잘못 입력했을 경우 발생했다. const decAES256 = (data) => { const key = '키' // key 32 바이트 const iv = '' // iv 16 바이트(생략가능) console.log(data) try { const decrypt = CryptoJS.AES.decrypt(data, CryptoJS.enc.Utf8.parse(key), { iv: CryptoJS.enc.Utf8.parse(iv), padding: CryptoJS.pad.Pkcs7, mode: CryptoJS.mode.CBC, // cbc 모드 }).toString(CryptoJS.en..
[Node] [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the cli
2023. 4. 3. 20:53
개발/Error note
서버가 클라이언트에 하나가 아닌 둘 이상의 여러가지 응답을 보내려 할 때 뜨는 에러다. 하나의 요청에서 하나의 응답이아닌 여러 응답을 보내려 할 때 뜨는 오류며 나의 코드는 app.use((req, res, next) => { const { password } = req.query; if (password === 'orange') { next(); } res.send('SORRY YOU NEED A PASSWORD!!!'); }); 이 상황에서 오류가 발생했다. if 문을 타지 않으면 상관없지만 if문을 타고 next 메소드를 응답하고 나와서 res.send 또한 응답하려 했기 때문에 떴던 오류이다. 해결방법 app.use((req, res, next) => { const { password } = re..
[git] remote: fatal error in commit_refs
2023. 3. 27. 22:22
개발/Error note
푸시가 안된다. 처음엔 내가 잘못한줄 알았다Enumerating objects: 28, done. Counting objects: 100% (28/28), done. Delta compression using up to 8 threads Compressing objects: 100% (16/16), done. Writing objects: 100% (17/17), 3.17 KiB | 540.00 KiB/s, done. Total 17 (delta 7), reused 0 (delta 0), pack-reused 0 remote: Resolving deltas: 100% (7/7), completed with 7 local objects. remote: fatal error in commit_refs To ..
[Mongoose] MongoParseError: option usecreateindex is not supported
2023. 3. 24. 10:32
개발/Error note
유데미 강의를 따라하던 중 오류가 발생했다.MongoParseError: option usecreateindex is not supported 3000포트는 연결됐고.. 보니 몽고디비 모듈중 오류가 나는게 있었다.mongoose.connect('mongodb://localhost:27017/yelp-camp', { useNewUrlParser: true, useCreateIndex: true, useUnifiedTopology: true, });몽구스를 연결하기위해 옵션으로 사용한 키 중 useCreateIndex가 더이상 지원이 되지 않는다는 오류였다. 찾아보니 몽구스 버전이 6.0.0 이상이라면 useNewUrlParser: true, useUnifiedTopology: true, useCreateI..
[Node] Error: Cannot find module '파일명'
2023. 3. 15. 22:00
개발/Error note
const math = require('math');파일을 참조하려고 했는데 Cannot find module 이라는 오류가 떴다. fs같은 기존 모듈이아닌 파일을 참조하는 경우에는 경로를 명확하게 해줘야 한다. const blue = require('./blue'); const janet = require('./janet'); const sadie = require('./sadie');경로를 수정한 후 다시 node 실행 (하면서 바라볼 파일도 바꿨음 ㅎ_ㅎ)