Data Not Showing Up
How to debug blank pages, missing data, and API routes that return empty.
What Does "Data Not Showing Up" Look Like?
The page loads without errors but something is missing:
- Lists are empty
- Cards show no content
- Charts have no data points
- Tables have no rows
- The API returns
[]ornull
Understanding the Data Flow
Data flows through a chain. If any link breaks, data will not appear:
Database (PostgreSQL on Neon)
-> SQL query in API route (app/api/...)
-> fetch() call in page or component
-> Render in JSX
If data is missing, one of these steps is broken.Step 1: Check the Browser Network Tab
The Network tab shows you exactly what the API returns:
1. Open Chrome DevTools (F12 or Cmd+Option+I)
2. Click the 'Network' tab
3. Reload the page
4. Look for API calls (filter by 'Fetch/XHR')
5. Click on the request to see the Response
6. Check if the response contains data or is emptyThis tells you where the problem is:
| What Network Tab Shows | Problem Is In |
|---|---|
API returns [] (empty array) | Server / database query |
| API returns data but page is blank | Frontend rendering code |
| API call returns 500 error | Server error (see Server-Side Errors) |
| No API call is made | Frontend code is not calling the API |
Step 2: Debug the API Route
If the API returns empty data, the query might be wrong:
Step 3: Debug the Frontend
If the API returns data but the page is still blank:
Local vs. Deployed
Remember: local development does not have database access. Data will only appear in:
- PR preview environments (isolated Neon database branch)
- Production (the live app)
If you are testing locally and see no data, this is expected. Push your changes, create a PR, and test on the preview URL.
Testing API Routes Locally
You can still test API route logic locally, even without a database:
# Start the dev server
pnpm dev:your-app-name
# Test the API in another terminal
curl http://localhost:3000/api/your-route
# If you see [] or null, check the API route logic
# Note: Database queries will fail locally (this is expected)Common Causes
- Wrong API endpoint URL — typo in the fetch URL
- Database query returns wrong columns — SELECT does not include the needed fields
- Data format mismatch — API returns
{ data: [...] }but the component expects[...] - Missing error handling — the fetch fails silently and no data is shown
- Environment variable not set —
DATABASE_URLmissing in Railway (check deploy settings)
Quiz
Your page loads without errors but the list is empty. The API returns []. Where is the problem?