-
Notifications
You must be signed in to change notification settings - Fork 2
Closed
Labels
bugSomething isn't workingSomething isn't workinghelp wantedExtra attention is neededExtra attention is needed
Description
The dashboard crashes with a client-side exception when loading the server settings page.
The browser console shows multiple 401 Unauthorized and 400 Bad Request responses from the API, which results in the frontend attempting to access undefined data.
This eventually triggers the following error:
TypeError: Cannot read properties of undefined (reading 'map')
Because the frontend expects data from the API but receives an error response instead.
Console Errors
Failed to load resource: the server responded with a status of 401 ()
SWR Error for /api/server/{serverId}/stats: Error: Failed to fetch
/api/server/{serverId}/guild-data: Failed to load resource: the server responded with a status of 401 ()
TypeError: Cannot read properties of undefined (reading 'map')
at settings-66df800ede93c48c.js
Steps to Reproduce
- Open the Miku dashboard
- Navigate to a server settings page
- Open browser developer console
- Observe the API errors and client-side crash
Expected Behavior
- API should return valid authenticated responses
- Frontend should gracefully handle API errors
- Dashboard should not crash even if API fails
Actual Behavior
- API returns 401 Unauthorized
- Frontend receives undefined data
- React component attempts to call
.map()on undefined - Dashboard throws a client-side exception and crashes
Screenshot
Attach screenshot of the console errors and dashboard crash.
Possible Causes
- Authentication token not being sent in API requests
- Session expiration or invalid OAuth token
- API authorization middleware rejecting requests
- Frontend not validating API response before rendering
Suggested Fix
Add a safe check before mapping data in the frontend:
const items = data?.items || [];
items.map(...)Or:
if (!data) return null;Also ensure the API request includes authentication headers.
Environment
- Dashboard: https://miku-two.vercel.app
- API: Render deployment
- Frontend: Next.js
- Bot Framework: discord.py
- Database: PostgreSQL
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workinghelp wantedExtra attention is neededExtra attention is needed