examples/nextjs-server-side-error-debugging/SKILL.md
Debug getServerSideProps and getStaticProps errors in Next.js. Use when: (1) Page shows generic error but browser console is empty, (2) API routes return 500 with no details, (3) Server-side code fails silently, (4) Error only occurs on refresh not client navigation. Check terminal/server logs instead of browser for actual error messages.
npx skillsauth add abhattacherjee/claudeception nextjs-server-side-error-debuggingInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Server-side errors in Next.js don't appear in the browser console, making debugging frustrating when you're looking in the wrong place. The browser shows a generic error page or 500 status, but no stack trace or useful error information appears in DevTools.
This skill applies when:
getServerSideProps, getStaticProps, or API routesCommon misleading symptoms:
The actual error with full stack trace appears in the terminal where npm run dev
or next dev is running. This is the first place to look.
# If you don't see the terminal, find the process
ps aux | grep next
# Or restart with visible output
npm run dev
For persistent debugging, wrap server-side code with try-catch:
export async function getServerSideProps(context) {
try {
const data = await fetchSomething();
return { props: { data } };
} catch (error) {
console.error('getServerSideProps error:', error);
// Return error state instead of throwing
return { props: { error: error.message } };
}
}
Check your hosting provider's logs:
After checking the terminal, you should see:
Symptom: User reports page shows "Internal Server Error" after clicking a link.
Investigation:
GET /dashboard → 500npm run dev:Error: Cannot read property 'id' of undefined
at getServerSideProps (/app/pages/dashboard.tsx:15:25)
at renderToHTML (/app/node_modules/next/dist/server/render.js:428:22)
Cause found: Database query returned null instead of user object.
reactStrictMode: true in next.config.js causes double-execution of server
functions in development, which can make debugging confusingnext start (production mode locally), errors may be less verbose;
check NODE_ENV and consider adding custom error loggingdevelopment
Detect and resolve TypeScript/JavaScript circular import dependencies. Use when: (1) Cannot access X before initialization at runtime, (2) Import returns undefined unexpectedly, (3) ReferenceError Cannot access X before initialization, (4) Type errors that disappear when you change import order, (5) Jest/Vitest tests fail with undefined imports that work in browser.
devops
Fix Prisma Too many connections and connection pool exhaustion errors in serverless environments (Vercel, AWS Lambda, Netlify). Use when: (1) Error P2024 Timed out fetching a new connection from the pool, (2) PostgreSQL too many connections for role, (3) Database works locally but fails in production serverless, (4) Intermittent database timeouts under load.
development
Extracts reusable knowledge from work sessions and codifies it into Claude Code skills. Use when: (1) /claudeception command to review session learnings, (2) save this as a skill or extract a skill from this, (3) what did we learn?, (4) after non-obvious debugging, workarounds, or trial-and-error discovery. Evaluates whether current work contains extractable knowledge, checks for existing skills, and creates or updates skills following the skill-authoring best practices.
tools
Use when work should span one or more detached tasks but still behave like one job with a single owner context. TaskFlow is the durable flow substrate under authoring layers like Lobster, ACPX, plugins, or plain code. Keep conditional logic in the caller; use TaskFlow for flow identity, child-task linkage, waiting state, revision-checked mutations, and user-facing emergence.