Server-Side Errors

How to find and fix Railway deploy logs, API route errors, and 500 responses.

What Are Server-Side Errors?

Server-side errors happen on the server (Railway), not in your browser. You might see:

  • A "500 Internal Server Error" message in the browser
  • An API request that returns an error
  • A deploy that fails on Railway

The browser cannot tell you the details — you need to check the server logs.

How to Check Railway Logs

Step 1: Find the Logs

Go to the Railway dashboard, select your service, click the Deployments tab, and click View logs on the active deployment.

Step 1: Select your service, click Deployments tab, then View logs

Step 2: Find the Error

In the Deploy Logs tab, look for red lines — these are errors. Normal log lines are white/gray.

Step 2: Look for red error lines in the Deploy Logs tab

Step 3: Copy the Error Message

Click on the red error line to expand its details. You will see the full error message in the Name/Value attributes. Copy this text and give it to Claude.

Step 3: Click the error to see details, then copy the error message

Server logs show everything the app prints while running, including error messages with file names and line numbers.

Understanding 500 Errors

When the browser shows "500 Internal Server Error", it means something crashed on the server. The browser only knows something went wrong — the details are in Railway logs.

Report a 500 error
Claude prompt
my-app-name: The app returns a 500 error when I try to load the dashboard page. Browser shows: "500 Internal Server Error" Here are the Railway logs: [Paste the error from Railway deploy logs] Please find and fix the server-side error.

API Route Errors

Next.js API routes (app/api/...) run on the server. Common issues:

ProblemLikely Cause
500 error on API callBug in the API route code (check Railway logs)
404 on API callWrong URL path or missing API file
Empty responseDatabase query returned no data
TimeoutQuery too slow or infinite loop
Debug an API route
Claude prompt
my-app-name: The API route /api/users is returning a 500 error. Browser console shows: "GET /api/users 500 (Internal Server Error)" Railway logs show: [Paste error logs] Can you fix the API route?

Testing API Routes Locally

You can test API routes locally before pushing:

Test API routesbash
# Start the dev server
pnpm dev:your-app-name

# In another terminal, test the API
curl http://localhost:3000/api/your-route

Note: API routes that query the database will not work locally (database is only available in PR preview environments). But you can still check for syntax errors and logic issues.

Common Server Error Causes

  • Missing environment variables — a variable required by the app is not set in Railway
  • Database query errors — wrong table name, wrong column, SQL syntax error
  • Import errors — importing a file or package that does not exist
  • Type errors at runtime — passing wrong data types to functions

Checking Preview Deploy Logs

When your PR preview deployment is not working:

Debug a preview deploy issue
Claude prompt
my-app-name: My PR preview deployment is showing errors. The app works locally but fails on the preview. Here are the Railway deploy logs: [Paste the error logs] Can you investigate why the deploy is failing?

Quiz

Quiz

Where do you find the details of a 500 Internal Server Error?