codestates / codestates/Donorticon

[Error Handling] jwt 관련 에러

Open
#208 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
1
Forks
0
PR merge metrics
No merged PRs in 30d

Description

### 관련 Issue
jwt 관련 에러

### 어떤 문제인가요?
홈페이지에서 페이지 이동을 계속 진행하다보면
가끔씩 아래와 같은 에러 메세지 출력

### 에러 메시지
```jsx
JsonWebTokenError: jwt malformed
at Object.module.exports [as verify] (/Users/tiahwang/Desktop/Donorticon/server/node_modules/jsonwebtoken/verify.js:63:17)
at get (/Users/tiahwang/Desktop/Donorticon/server/controller/gifticon/gifticon.js:11:24)
at Layer.handle [as handle_request] (/Users/tiahwang/Desktop/Donorticon/server/node_modules/express/lib/router/layer.js:95:5)
at next (/Users/tiahwang/Desktop/Donorticon/server/node_modules/express/lib/router/route.js:137:13)
at Route.dispatch (/Users/tiahwang/Desktop/Donorticon/server/node_modules/express/lib/router/route.js:112:3)
at Layer.handle [as handle_request] (/Users/tiahwang/Desktop/Donorticon/server/node_modules/express/lib/router/layer.js:95:5)
at /Users/tiahwang/Desktop/Donorticon/server/node_modules/express/lib/router/index.js:281:22
at Function.process_params (/Users/tiahwang/Desktop/Donorticon/server/node_modules/express/lib/router/index.js:341:12)
at next (/Users/tiahwang/Desktop/Donorticon/server/node_modules/express/lib/router/index.js:275:10)
at Function.handle (/Users/tiahwang/Desktop/Donorticon/server/node_modules/express/lib/router/index.js:174:3)
[nodemon] app crashed - waiting for file changes before starting...
```

### 에러 핸들링 방법

해당 에러코드를 구글에 검색해보니 stackoverflow에서 아래와 같은 게시글 발견
[스택 오버플로우 고고](https://stackoverflow.com/questions/65277469/jsonwebtokenerror-jwt-malformed-creating-an-api-in-expressjs)

일단 저기에 적혀있는데로 코드를 수정해보고
에러가 더이상 생기지 않는지 확인해 볼 필요가 있음

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reading the get handler in server/controller/gifticon/gifticon.js and trace how the JWT reaches jsonwebtoken.verify. Reproduce the repeated page navigation that triggers the malformed-token error, then confirm the server no longer crashes and handles the invalid token appropriately.

Written by the indexing model from the issue text.

Assessment

Tech stack
express, javascript, node.js
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.