nextjs-server-side-error-debugging

Diagnose getServerSideProps and getStaticProps errors by locating server-side stack traces.

1|Updated May 6, 2026
One-click install
npx skills add https://github.com/surfingalien/FinSurfing --skill nextjs-server-side-error-debugging-surfingalien
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: nextjs-server-side-error-debugging
Source: https://github.com/surfingalien/FinSurfing/tree/main/.claude/skills/continuous-learning/examples/nextjs-server-side-error-debugging
Command: npx skills add https://github.com/surfingalien/FinSurfing --skill nextjs-server-side-error-debugging-surfingalien

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Server-side errors in Next.js never appear in the browser console, leaving developers staring at a generic 500 page with no stack trace. This Skill redirects debugging to the correct location—the terminal or hosting logs—so the real error message surfaces quickly. ## Core Features & Use Cases - Error Location Guidance: Directs you to the terminal running next dev where full stack traces with file names and line numbers actually appear. - Defensive Error Handling Patterns: Provides try-catch wrappers for getServerSideProps and API routes that return error state as props instead of throwing. - Production Log Lookup: Covers where to find server errors on Vercel, AWS CloudWatch, Netlify, and self-hosted Node.js processes. - Use Case: A page shows "Internal Server Error" only on refresh, the browser console is empty, and the Network tab shows a bare 500. Following this Skill, you check the dev terminal and find Cannot read property 'id' of undefined at dashboard.tsx:15, revealing a null database result. ## Quick Start Ask the assistant to debug why my Next.js page returns a 500 error on refresh with nothing in the browser console.

Frequently Asked Questions about nextjs-server-side-error-debugging

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I debug Next.js server-side errors that don't appear in the browser?

Check the terminal where `npm run dev` or `next dev` is running. Server-side errors from getServerSideProps and API routes print full stack traces there, not in the browser console or DevTools.

Why does my Next.js page show 500 error but the console is empty?

The error occurs in server-side code, which executes in Node.js, not the browser. The browser only receives the generic 500 response, while the actual stack trace appears in the server terminal or hosting logs.

Where do I find Next.js error logs in production on Vercel?

Open the Vercel dashboard, select your project, and check the Logs section under the Functions tab. For AWS use CloudWatch Logs, for Netlify check the Functions tab, and for self-hosted setups inspect the Node.js process logs.

How do I add error handling to getServerSideProps?

Wrap the data fetching logic in a try-catch block, log the error with console.error, and return the error message as a prop instead of throwing. This renders an error state in the page rather than crashing with a 500.

Why does a Next.js error only happen on refresh but not client navigation?

Client-side transitions fetch data via JSON requests handled in the browser context, while a refresh triggers full server-side rendering. Errors in getServerSideProps or getStaticProps only execute during the server render path.

What are common causes of Next.js server-side errors?

Common causes include missing environment variables in production, database connection failures, server-only code imported on the client, missing await on async calls, and non-serializable objects like dates or functions returned as props.