Skip to content

로그아웃 버튼 배포에서 작동 안되는 문제 수정#449

Open
Bangdayeon wants to merge 1 commit intomainfrom
fix/#439-logout-error
Open

로그아웃 버튼 배포에서 작동 안되는 문제 수정#449
Bangdayeon wants to merge 1 commit intomainfrom
fix/#439-logout-error

Conversation

@Bangdayeon
Copy link
Copy Markdown
Member

관련 이슈

PR 설명

  • route파일을 수정하여 배포에서 로그아웃이 동작하지 않는 문제 수정

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 26, 2026

Warning

Rate limit exceeded

@Bangdayeon has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 14 minutes and 41 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: c8e701e6-7873-47c9-85a6-e744f8c7c4a1

📥 Commits

Reviewing files that changed from the base of the PR and between e5a218d and e339843.

📒 Files selected for processing (2)
  • src/app/api/member/logout/route.ts
  • src/hooks/useLogout.ts

Walkthrough

서버 로그아웃 엔드포인트(/src/app/api/member/logout/route.ts)가 cookieStore.delete() 대신 NextResponse를 생성하여 ACCESS_TOKEN, REFRESH_TOKEN, USER_INFO 쿠키를 명시적 옵션(path, domain, expires, secure, sameSite)으로 삭제하도록 변경되었습니다. 백엔드 호출 실패 여부를 logoutFailed로 추적해 실패 시 HTTP 502와 { success: false }, 성공 시 200과 { success: true }를 반환합니다. 클라이언트 훅(src/hooks/useLogout.ts)에서는 'use client' 지시문을 제거하고 clearCookies() 헬퍼로 성공·실패 콜백 모두에서 쿠키를 삭제한 뒤 캐시를 비우고 루트로 이동하도록 수정되었습니다.

Possibly related PRs

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed 제목이 변경사항의 핵심을 명확하게 설명하고 있습니다. 배포 환경에서 동작하지 않는 로그아웃 버튼 문제 수정이라는 주요 변경사항을 직접적으로 반영합니다.
Description check ✅ Passed PR 설명이 필수 구조(관련 이슈, PR 설명)를 따르고 있으며, 핵심 변경사항(route 파일 수정)을 포함하고 있습니다.
Linked Issues check ✅ Passed 코드 변경사항이 #439 이슈의 요구사항을 충족합니다. 로그아웃 시 토큰(ACCESS_TOKEN, REFRESH_TOKEN, USER_INFO) 삭제 및 페이지 이동을 구현했습니다.
Out of Scope Changes check ✅ Passed 모든 변경사항이 로그아웃 기능 수정이라는 범위 내에서 이루어졌습니다. route 파일과 useLogout 훅의 변경이 모두 #439 문제 해결에 필요한 수정입니다.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/#439-logout-error

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/app/api/member/logout/route.ts`:
- Line 20: The route currently always returns NextResponse.json({ success: true
}) which hides server-side logout failures; wrap the server-side
logout/token/session revocation logic in a try/catch inside the handler in
src/app/api/member/logout/route.ts (the function handling the request/response),
and on success return the existing success response but on failure return a
non-200 response (e.g., NextResponse.json({ success: false, error: "<message>"
}, { status: 500 })) so callers can detect server-side failures; keep
client-side cookie cleanup (useLogout onError) as-is so local logout still
occurs while surfacing server errors.
- Around line 22-29: The logout route currently hardcodes domain via isProd into
cookieOptions (const cookieOptions) which can mismatch client-side
deleteCookieUtil(), causing cookie deletion to fail; update cookieOptions in the
logout handler to stop hardcoding domain — either read the cookie domain from an
environment variable (e.g., process.env.COOKIE_DOMAIN) and use that instead of
'.linkiving.com', or remove the domain property entirely so it mirrors the
client deleteCookieUtil() behavior; ensure sameSite/secure logic (isProd)
remains intact and reference cookieOptions and isProd in your change so the
logout route and client use the same domain resolution strategy.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: a28ff4e9-a650-45cf-aa33-84c188ce5078

📥 Commits

Reviewing files that changed from the base of the PR and between 488e088 and f55df3a.

📒 Files selected for processing (2)
  • src/app/api/member/logout/route.ts
  • src/hooks/useLogout.ts

@Seong-Myeong
Copy link
Copy Markdown
Contributor

코드래빗 답변 확인부탁드립니다 @Bangdayeon

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/app/api/member/logout/route.ts`:
- Around line 27-41: The logout route's cookieOptions (isProd, secure, sameSite:
'none') must match the middleware's cookie attributes to ensure browser will
accept deletion; update the cookieOptions used in response.cookies.set (the
cookieOptions object near isProd and the three response.cookies.set calls) to
use the same attributes as your middleware (at minimum path: '/' and sameSite:
'lax' — and omit or align secure/domain flags exactly as middleware does), then
re-run tests/verification; ensure COOKIES_KEYS.ACCESS_TOKEN,
COOKIES_KEYS.REFRESH_TOKEN and COOKIES_KEYS.USER_INFO are cleared with the new
unified options.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 3009fff5-a352-462e-a762-a342bae89c1d

📥 Commits

Reviewing files that changed from the base of the PR and between f55df3a and e5a218d.

📒 Files selected for processing (2)
  • src/app/api/member/logout/route.ts
  • src/hooks/useLogout.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/hooks/useLogout.ts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

로그아웃 버튼 동작 안됨

2 participants