fix: resolve dashboard session drop and implement metrics caching fallback#438
fix: resolve dashboard session drop and implement metrics caching fallback#438SatyaViswas wants to merge 3 commits into
Conversation
|
@SatyaViswas is attempting to deploy a commit to the PRIYANSHU DOSHI's projects Team on Vercel. A member of the Team first needs to authorize it. |
GSSoC Label Checklist 🏷️@Priyanshu-byte-coder — please apply the appropriate labels before merging: Difficulty (pick one):
Quality (optional):
Validation (required to score):
|
There was a problem hiding this comment.
Thanks for your first PR on DevTrack! 🎉
A maintainer will review it within 48 hours. While you wait:
- Make sure CI is passing (type-check + lint)
- Double-check the PR description is filled out and the issue is linked
- Feel free to ask questions in Discussions if you need help
|
Also the settings page works perfectly on my version, but doesn't work on the main deploy link. Before: Screen.Recording.2026-05-20.at.4.33.19.PM.movAfter: Screen.Recording.2026-05-20.at.4.32.47.PM.mov |
Priyanshu-byte-coder
left a comment
There was a problem hiding this comment.
Conflicts with open PR #407 which targets the same files (src/lib/auth.ts cookie config, src/lib/github-accounts.ts) and is still pending. Resolve that conflict first.
Additional issues:
-
Unexplained cookie config removal — the PR removes the explicit
httpOnly: true,sameSite: 'lax',secure: true,maxAgecookie settings fromauth.ts. The PR claims this fixes session drops, but does not explain the causal link. Next-auth defaults should be equivalent, but this is a security-relevant change that needs explicit justification. -
Unbounded memory cache — the new
memoryCacheMap inmetrics-cache.tshas no max-size limit or LRU eviction. If Redis is down in production, this will grow until OOM. Add a max-entries cap. -
Dev-mode rate limits —
AUTHENTICATED_LIMIT = 5000andANONYMOUS_LIMIT = 1000in dev mode are fine as local-only values, but include a comment explaining these are dev-only and never apply to production. -
anytype casts introduced — e.g.,runs.flat().filter((r: any) => r.conclusion)removes TypeScript safety from previously typed code. Use proper types. -
Missing EOF newlines on modified files.
|
Thank you for the review. I have updated the code to follow your precise constraints: Justification for Cookie Config Removal (auth.ts): The session drops occurred because the explicit cookies block manually overrode the sessionToken without defining equivalent mirrors for parallel fields like csrfToken and callbackUrl. In distributed dev-to-build edge cases, this asymmetry broke internal NextAuth token validation. Removing the manual block completely resolves this: NextAuth natively defaults to identical security flags (httpOnly: true, sameSite: "lax", and automatic __Secure- on HTTPS) while ensuring strict, internal cryptographic synchronization out of the box. Capped Memory Cache (metrics-cache.ts): Dev-Mode Rate Limits (middleware.ts): Eliminated any Casts (ci/route.ts): EOF Newlines Added: |
|
Hey @Priyanshu-byte-coder , also previous pr merged by another contributor to solve this issue didn't solve the problem. So I would like you to check this as it works perfectly! |
|
Hey @Priyanshu-byte-coder, I have solved all new conflicts. The main deployed website still has the session drop issues. My version still makes sure the session doesn't drop after hard refresh. Please review and merge the PR! |
Priyanshu-byte-coder
left a comment
There was a problem hiding this comment.
This PR has merge conflicts with main. Please rebase on the latest main branch and force-push to resolve:
git fetch origin
git rebase origin/main
git push --force-with-lease
|
Hey @Priyanshu-byte-coder , I solved the merge conflicts! |
252d741 to
04e5b94
Compare
04e5b94 to
493d6a2
Compare
Summary
This PR fixes the issue where the dashboard session drops on a page reload or hard refresh. It also resolves a chain-reaction cascade of 500 Internal Server Errors and 502 Bad Gateway errors across the dashboard widgets by adding robust fallback logic, token decryption error handling, and integrating a global development-safe cache shield for endpoints that were previously fetching directly from GitHub on every call.
Closes #428
Type of Change
Changes Made
How to Test
Steps for the reviewer to verify this works:
Screenshots (if UI change):
Before:
Screen.Recording.2026-05-20.at.4.01.21.PM.mov
After:
Screen.Recording.2026-05-20.at.4.02.35.PM.mov
Checklist
npm run lintpasses locallynpm run type-check)