Category

Next.js

Explore our curated collection of articles, insights, and stories about Next.js.

37 Articles
Cross-Origin-Opener-Policy Blocks window.closed: 2026 Fix
Next.js
7 min read·2026-09-01

Cross-Origin-Opener-Policy Blocks window.closed: 2026 Fix

The Firebase Google sign-in popup loses window.closed access when a COOP header isolates the opener. Here's the exact header change that restores the popup flow.

Read more
FirebaseError: Expected first argument to collection() — Fix
Next.js
7 min read·2026-08-30

FirebaseError: Expected first argument to collection() — Fix

When Firestore throws 'Expected first argument to collection()', it's almost always a missing Firestore instance. Learn the exact fix for Next.js and v9 modular SDK.

Read more
Next.js 16 /_not-found Prerender Build Error: The Real Fix
Next.js
9 min read·2026-08-29

Next.js 16 /_not-found Prerender Build Error: The Real Fix

Next.js 16 build crashes prerendering the internal /_not-found route. Here are the three actual causes behind it, how to tell which one is yours, and the fix for each.

Read more
Next.js 16 "use cache" Errors: Why Cache Components Break
Next.js
10 min read·2026-08-29

Next.js 16 "use cache" Errors: Why Cache Components Break

Next.js 16 replaced implicit caching with the explicit "use cache" directive. Here is what actually breaks when you flip cacheComponents on, and how to fix it without reverting.

Read more
useSearchParams Suspense Error: 3 Real Fixes (Next.js 15)
Next.js
6 min read·2026-06-27

useSearchParams Suspense Error: 3 Real Fixes (Next.js 15)

The error only surfaces during the production build — dev mode hides it completely. Here is why, and the three fixes ranked by situation.

Read more
Fix: Next.js proxy.js matcher not working for static assets
Next.js
7 min read·2026-06-27

Fix: Next.js proxy.js matcher not working for static assets

Without a matcher, proxy.js runs on every request including _next/static and public assets. And Server Functions are not separate routes — a matcher gap silently drops auth coverage.

Read more
Fix ChunkLoadError: Loading Chunk Failed in Next.js
Next.js
9 min read·2026-06-18

Fix ChunkLoadError: Loading Chunk Failed in Next.js

"ChunkLoadError: Loading chunk 5760 failed" almost always means a user has an old tab open after you shipped a new deploy. The fix is configuration — deploymentId, build IDs, and CDN headers — not a try/catch.

Read more
Fix Dynamic Server Usage Error in Next.js App Router
Next.js
9 min read·2026-06-18

Fix Dynamic Server Usage Error in Next.js App Router

Next.js throws this when a route it wants to render at build time calls a dynamic function — cookies(), headers(), searchParams, or a no-store fetch. The fix is either opt the route into dynamic rendering, or remove the request-time dependency if it should be static.

Read more
Fix next/image Hostname Not Configured in Next.js
Next.js
7 min read·2026-06-18

Fix next/image Hostname Not Configured in Next.js

next/image strictly allow-lists remote hosts. The fix is images.remotePatterns in next.config — matched exactly on protocol, hostname, port, and pathname. Get one wrong (http vs https, a subdomain, a missing port) and it still blocks.

Read more
use client vs use server in Next.js: The Real Difference
Next.js
8 min read·2026-06-18

use client vs use server in Next.js: The Real Difference

The #1 misconception in the App Router: "use server" is not the opposite of "use client". One marks a client boundary in the module graph; the other exposes callable server functions. Server Components are the default — no directive needed.

Read more
Next.js Build Passed But Production Broke
Next.js
8 min read·2026-06-17

Next.js Build Passed But Production Broke

A green build only proves the bundle compiled. This postmortem walks through three production-only failures: missing Vercel env vars, Edge runtime imports, and cache behavior that changed after deploy.

Read more
Next.js Middleware Not Running on Vercel: 3 Causes
Next.js
8 min read·2026-06-17

Next.js Middleware Not Running on Vercel: 3 Causes

Middleware that works locally can disappear in Vercel production because the matcher never matches, Edge bundles a Node-only import, or auth middleware cannot read the token. This guide gives you the diagnosis order I use before touching app code.

Read more
How to set the next/image component to 100% height
Next.js
7 min read·2026-06-14

How to set the next/image component to 100% height

If your <Image / component ignores height: 100% and appears too small or misaligned, the issue is almost always that the parent container lacks an explicit

Read more
Fix Module not found: Can't resolve 'encoding' in Vercel
Next.js
8 min read·2026-06-14

Fix Module not found: Can't resolve 'encoding' in Vercel

You see "Module not found: Can't resolve 'encoding'" in your Vercel deployment logs. This guide explains why it happens with cross-fetch/node-fetch and how to fix it permanently.

Read more
Next.js Query String Params: searchParams + useRouter
Next.js
6 min read·2026-06-06

Next.js Query String Params: searchParams + useRouter

If `router.query` examples keep breaking on you, the problem is usually that you're mixing App Router and Pages Router APIs. Here is the exact fix for each case.

Read more
Next.js Redirect from / to another page
Next.js
6 min read·2026-06-06

Next.js Redirect from / to another page

If your redirect works only after render, flickers, or fires in the wrong place, you are probably using the wrong redirect API for the job. Here is the exact mapping.

Read more
Why useEffect runs twice in Next.js dev
Next.js
6 min read·2026-06-06

Why useEffect runs twice in Next.js dev

If your logs, API calls, or subscriptions fire twice in local dev, you are probably seeing React's development-only Strict Mode check. Here is what to fix and what not to panic about.

Read more
How to Access Route Parameter Inside getServerSideProps
Next.js
8 min read·2026-06-05

How to Access Route Parameter Inside getServerSideProps

Learn why your dynamic route parameter appears as undefined in getServerSideProps and how to correctly extract it from the context object for server-side data fetching.

Read more
Fix 'Next.js 15 requires Node.js 18.18' Build Error
Next.js
8 min read·2026-06-05

Fix 'Next.js 15 requires Node.js 18.18' Build Error

Next.js 15 drops support for older Node versions. Here is how to upgrade to Node.js 18.18.0 or later and fix build errors.

Read more
How to Change the Port in Next.js (and Fix EADDRINUSE)
Next.js
7 min read·2026-06-02

How to Change the Port in Next.js (and Fix EADDRINUSE)

Change the default Next.js port when it collides with another process. Step‑by‑step fix with code, verification, and prevention tips.

Read more
Fix React 18 Hydration Mismatch in Next.js
Next.js
7 min read·2026-06-02

Fix React 18 Hydration Mismatch in Next.js

A step‑by‑step fix for the React 18 hydration mismatch error in Next.js apps, covering root cause, code changes, verification, and prevention.

Read more
Fix "lcp" not working in production
Next.js
7 min read·2026-06-01

Fix "lcp" not working in production

When LCP data never appears in your analytics, a missing reportWebVitals export is usually to blame. Follow these steps to fix it.

Read more
How to implement LCP end to end
Next.js
7 min read·2026-06-01

How to implement LCP end to end

Learn how to instrument Largest Contentful Paint (LCP) in a Next.js project, send the metric to your analytics provider, and verify that the data is accurate.

Read more
TypeError cookies() crash in Next.js route handler
Next.js
7 min read·2026-05-27

TypeError cookies() crash in Next.js route handler

A production‑grade fix for the `TypeError: cookies() is not a function` crash that appears in Next.js route handlers after a deploy.

Read more
Fix "cookies() should be awaited" Error in Next.js 15
Next.js
9 min read·2026-05-19

Fix "cookies() should be awaited" Error in Next.js 15

Next.js 15 broke synchronous `cookies().get()`. Every server-side call must now `await cookies()` first. Here's the precise migration — App Router pages, route handlers, Server Actions, and Supabase SSR — plus the codemod that fixes 90% of call sites automatically.

Read more
Fix Next.js revalidatePath Not Working in Server Actions
Next.js
8 min read·2026-05-19

Fix Next.js revalidatePath Not Working in Server Actions

Your Server Action mutates data but the page shows stale values until you hard-refresh. `revalidatePath` is one of those APIs that "succeeds" while doing nothing. Here are the six reasons it no-ops, with the exact fix for each — including the one nobody tells you about: `dynamic = 'force-static'`.

Read more
I Tanked My Core Web Vitals Score With Next.js Images
Next.js
13 min read·2026-04-21

I Tanked My Core Web Vitals Score With Next.js Images

Added images to my Next.js app and watched my Core Web Vitals tank. After debugging for days, here are the 7 fixes that brought my CLS score back to green.

Read more
Next.js Stale Data: How I Fixed Cache Revalidation
Next.js
15 min read·2026-04-21

Next.js Stale Data: How I Fixed Cache Revalidation

My mutations worked but the UI showed stale data. Took me a week to understand Next.js App Router caching. Here are the 6 fixes that made my data fresh again.

Read more
Next.js 15 Caching Explained: Why Data Shows Stale
Next.js
11 min read·2026-04-15

Next.js 15 Caching Explained: Why Data Shows Stale

Upgraded to Next.js 15 and suddenly your data is stale — or refreshing too often? The caching model changed completely. Here is what actually happens and how to control it.

Read more
How to Structure Your Next.js App Router Project for Scale
Next.js
2026-04-02

How to Structure Your Next.js App Router Project for Scale

Stop shoving everything into the components folder. Learn the Feature-Sliced Design pattern adapted perfectly for the Next.js App Router.

Read more
Offline-First Next.js + Supabase: Sync That Actually Works
Next.js
14 min read·2026-03-24

Offline-First Next.js + Supabase: Sync That Actually Works

Build a Next.js app that works offline, queues writes, and syncs cleanly to Supabase when the network returns — IndexedDB, sync queue, conflict resolution, with code.

Read more
Next.js Server Actions vs API Routes: When to Use Each
Next.js
10 min read·2026-03-10

Next.js Server Actions vs API Routes: When to Use Each

Understand the differences between Server Actions and API Routes in Next.js 15. Learn when to use each approach with real-world examples and performance comparisons.

Read more
Next.js + Supabase Performance: 7 Fixes Cut Load 70%
Next.js
14 min read·2026-02-25

Next.js + Supabase Performance: 7 Fixes Cut Load 70%

The 7 optimizations that took a sluggish Next.js + Supabase app from 4.2s LCP to 1.1s — RLS indexes, ISR config, image pipeline, and the connection-pooler trap on Vercel.

Read more
Next.js 15 vs 14: Real Benchmarks + Upgrade Verdict (2026)
Next.js
10 min read·2026-02-16

Next.js 15 vs 14: Real Benchmarks + Upgrade Verdict (2026)

Side-by-side benchmarks on real apps — build time, bundle size, runtime perf, and the breaking changes that hurt. The honest verdict on whether the upgrade is worth it.

Read more
Fix 'Hydration failed' in Next.js: 8 Root Causes (2026)
Next.js
12 min read·2026-02-03

Fix 'Hydration failed' in Next.js: 8 Root Causes (2026)

Hydration mismatch errors breaking your Next.js app? Learn the root causes and 8 proven fixes to eliminate these errors permanently.

Read more
Next.js 'Module not found: Can't resolve': 6 Fixes
Next.js
11 min read·2026-02-01

Next.js 'Module not found: Can't resolve': 6 Fixes

Module not found errors only in production? Learn why Next.js builds fail after deploy and get 6 proven fixes that work on Vercel, AWS, and other platforms.

Read more
Next.js Turbopack Stuck on Compiling? 5 Fixes (2026)
Next.js
9 min read·2026-01-30

Next.js Turbopack Stuck on Compiling? 5 Fixes (2026)

Turbopack stuck on compiling in Next.js 15/16? Learn the exact causes and 5 proven fixes, plus how to disable Turbopack safely with next build --webpack when production builds crash.

Read more