inflearn logo
강의

강의

N
챌린지

챌린지

멘토링

멘토링

N
클립

클립

로드맵

로드맵

지식공유

[개정3판] Node.js 교과서 - 기본부터 프로젝트 실습까지

redis에 세션 저장하기

레디스 에러

838

roider2316

작성한 질문수 52

0

redis는 4.6.10 버전 쓰고 있고 connect-redis는 7.1.0 버전을 쓰고 있습니다. 레디스 코드를 깃허브에 업데이트 된 것 처럼 수정해 주었는데 로그인을 하려니

C:\Users\mikg2\Desktop\NodeBird-production\node_modules\@redis\client\dist\lib\client\RESP2\encoder.js:17
            throw new TypeError('Invalid argument type');
                  ^

TypeError: Invalid argument type
    at encodeCommand (C:\Users\mikg2\Desktop\NodeBird-production\node_modules\@redis\client\dist\lib\client\RESP2\encoder.js:17:19)
    at RedisCommandsQueue.getCommandToSend (C:\Users\mikg2\Desktop\NodeBird-production\node_modules\@redis\client\dist\lib\client\commands-queue.js:138:45)
    at Commander._RedisClient_tick (C:\Users\mikg2\Desktop\NodeBird-production\node_modules\@redis\client\dist\lib\client\index.js:519:76)
    at Commander._RedisClient_sendCommand (C:\Users\mikg2\Desktop\NodeBird-production\node_modules\@redis\client\dist\lib\client\index.js:506:82)
    at Commander._RedisClient_legacySendCommand (C:\Users\mikg2\Desktop\NodeBird-production\node_modules\@redis\client\dist\lib\client\index.js:460:105)
    at Commander.sendCommand (C:\Users\mikg2\Desktop\NodeBird-production\node_modules\@redis\client\dist\lib\client\index.js:432:114)
    at <computed> [as set] (C:\Users\mikg2\Desktop\NodeBird-production\node_modules\@redis\client\dist\lib\client\index.js:478:27)
    at Object.set (C:\Users\mikg2\Desktop\NodeBird-production\node_modules\connect-redis\dist\cjs\index.js:24:34)    at RedisStore.set (C:\Users\mikg2\Desktop\NodeBird-production\node_modules\connect-redis\dist\cjs\index.js:71:39)
    at Session.save (C:\Users\mikg2\Desktop\NodeBird-production\node_modules\express-session\session\session.js:72:25)
Emitted 'error' event on Commander instance at:
    at C:\Users\mikg2\Desktop\NodeBird-production\node_modules\@redis\client\dist\lib\client\index.js:466:31     

Node.js v18.16.0

이런 에러가 뜨는데 버전 문제인가요? 모듈 내부적으로 발생한 거라 어디를 손봐야 할 지 모르겠습니다.
참고로 세션 객체는

Session {
  cookie: {
    path: '/',
    _expires: null,
    originalMaxAge: null,
    httpOnly: true,
    secure: false
  }
}

이렇게 찍혔습니다.

node.js mysql mongodb express typescript socket.io jwt

답변 1

1

제로초(조현영)

redis 최신 버전에서 나는 에러인데요. legacyMode 옵션을 반대로 바꿔보세요. true면 false로요

0

roider2316

오 이게 되네요 ㄷㄷ 적어도 사용하는 옵션이 뭔지는 알아야 겠네요. 감사합니다.

깃헙 질문

0

78

2

강의 1-1 수업노트의 로드맵 링크가 작동하지 않습니다.

0

73

1

aws - lightsail 이용 관련

0

55

1

4강 http 서버 만들때 ESM방식으로 해도 될까요?

0

76

2

모듈 사용 시 단점이 있나요?

0

76

1

node.js 버전 및 typescript 적용 문의

0

90

2

12.7. 방장기능(강퇴) 질문드립니다.

0

77

2

12.7 socket.js코드 그대로 뱃겨서 했는데, socket.request.session.color가안나오네요

0

66

1

12.7 코드 그대로 뱃겨서 햇는데 스샷같이 오류가뜹니다.

0

72

2

12.7.1스스로 해보기 질문되나요

0

86

3

시퀄라이즈 실습하기 질문드립니다.

0

178

9

<7-5. 시퀄라이즈 사용하기>수업 질문 드립니다.

0

92

2

크롬에서 user id를 인풋에 입력하고 등록하면 404 에러처리 페이지가 뜹니다.

0

108

2

구매 결제관련 질문입니다 !

0

118

1

다수의 supertest 가 실행될 때 force:true로 인한 DB 초기화 문제

0

128

2

node 설치 방법이 전혀다르게 바뀐것 같습니다.

0

145

2

12강 깃허브에 있는 12.7 chat.html 복붙했는데 css오류

0

118

2

무료/프리미엄 동시 소유 시 질문

0

112

1

비주얼 스튜디오 코드로 계속 진행해도 괜찮을까요?

0

132

2

10강 cors에러 localhost:4000으로 접속했을때 에러

1

153

2

webstorm 해결할 수 없는 변수 문제

0

150

2

혹시 몽고DB 쓸거면 MySQL 강의 스킵해도 되나요?

0

143

2

LightSail 실행 중 오류 질문드립니다!

0

196

2

RedisStore 사용법 질문

0

127

2