[React] useEffect must not return anything besides a function, which is used for clean-up.....
2023. 5. 27. 21:28
개발/Error note
기능 구현중에 useEffect안에서 async - await 함수를 써야하는 경우가 생겼다. 아무생각없이 useEffect( async() => { const sampleFunction = await() => { ... } }, []) 처럼 쓰려고 했더니 아래처럼 useEffect must not return anything besides a function.. 어쩌구 오류가 났다. 해석해보니 useEffect 안에서 비동기 함수를 작성하는 법을 알려주고 있었다. 위 오류에서 안내해주는 설명서에 따라서 코드를 고쳤다. useEffect( () => { const fetchData = async () => { const sampleFunction = await() => { ... } } fetchData..
[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..