Skip to content

fix: prevent 500 error loop by adding error handling to auth redirect#45

Open
1028bc wants to merge 1 commit intoOpire:mainfrom
1028bc:fix/routing-loop-error
Open

fix: prevent 500 error loop by adding error handling to auth redirect#45
1028bc wants to merge 1 commit intoOpire:mainfrom
1028bc:fix/routing-loop-error

Conversation

@1028bc
Copy link

@1028bc 1028bc commented Mar 8, 2026

🏷️ Type of PR

  • 🐛 Bug Fix

📋 Required Checks

  • 👀 I Read the Contributing Guide
  • ✅ The Test are Passing
  • 💅 The Code is Linted
  • 🗂️ The Code is Well Structured

📝 Description of the Changes

Wrapped the getUserAuth() check in app/_utils/redirectToHomeIfNotLogged.ts with a try-catch block. Previously, if the local backend was unreachable, the auth check would fail and force a redirect to /, which forwarded to /home and caused a continuous "500 Internal Error: fetch failed" loop. This fix ensures the app catches the connection error and prevents the infinite redirect loop.

📋 Other Checks

  • Affects the UI

📌 Reference Issues (Optional)

Closes #44

🔍 Anything else? (Optional)

This significantly improves the local development experience and offline state stability when the port 8080 backend is down.

@vercel
Copy link

vercel bot commented Mar 8, 2026

Someone is attempting to deploy a commit to the Opire's projects Team on Vercel.

A member of the Team first needs to authorize it.

@1028bc 1028bc force-pushed the fix/routing-loop-error branch from 02ea6bc to e28814f Compare March 10, 2026 13:52
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.

fix: 500 Internal Error and redirect loop when backend is unreachable

1 participant