fix: resolve 500 server crash on settings and github-accounts api routes (#597)#2541
fix: resolve 500 server crash on settings and github-accounts api routes (#597)#2541anjalikumari45 wants to merge 1 commit into
Conversation
|
Thanks for your first PR on DevTrack! 🎉 A maintainer will review it within 48 hours. While you wait:
If you find DevTrack useful, a ⭐ star on the repo is always appreciated — it helps the project grow and attract more contributors! |
GSSoC Label Checklist 🏷️@Umbrella-io — please apply the appropriate labels before merging: Difficulty (pick one):
Quality (optional):
Validation (required to score):
|
|
Hi , I have submitted a PR to resolve the 500 Internal Server Error occurring on the settings and GitHub accounts API routes (related to issue #597). I have refactored the fetch logic to include proper error boundaries and graceful fallbacks, ensuring the dashboard renders correctly even when database schema migrations are pending. I have also verified that the changes pass linting and type-checking. Whenever you have a moment, I would appreciate your review on this fix. Thank you!" Tips for your comment: Be Patient: As noted by the github-actions bot, maintainers typically review PRs within 48 hours. Avoid "pinging" them multiple times unless significant time has passed. Keep it focused: You have already provided a great summary in the PR description, so this comment just serves as a polite nudge to draw attention to your work. Would you like me to help you draft a specific response if the owner asks for changes later? |
Summary
This PR resolves a cascading 500 Internal Server Error affecting the dashboard Settings page, which caused the UI to fail with a "Failed to load" message. It cleans up broken fallback code and introduces robust error boundaries to ensure the settings dashboard always renders smoothly.
Closes #597
Type of Change
What Changed
src/app/api/user/settings/route.ts: RefactoredfetchUserSettingsto remove redundant database schema fallback blocks that incorrectly passed database errors down the chain, causing theGETfunction to return a hard500error. Configured fallback to return a clean, schema-safe default data object instead.src/app/api/user/github-accounts/route.ts: Added defensive try-catch and empty database match boundaries. If the accounts connection table fails or is uninitialized, the route now gracefully outputs an empty array ({ accounts: [] }) to the client instead of throwing an unhandled runtime error.How to Test
/dashboard/settings).user_github_accountstable schemas have not been seeded or migrated yet.Expected result:
The Settings page UI should render completely without dropping a "Failed to load" banner error. The sub-components should read empty fallback parameters cleanly instead of hitting crashing server API tracks.
Screenshots / Recordings
Checklist
console.log, debug code, or commented-out blocksnpm run lintpasses locallynpm run type-check)Accessibility (UI changes only)
Skip - API optimization backend handling logic fix only.
Additional Context
The fix streamlines the progressive database structure logic so that environment-level table anomalies don't prevent the active user from configuring general settings preferences.