Troubleshooting guides by topic

Next.js, React and TypeScript

Client/server rendering, components, hooks, TypeScript and build errors.

70 English guides in this category

New article does not go to sitemap.xml in Next.js

How to find an error in generating sitemap Next.js and make sure that new addresses are visible to robots.

Read the solution

Next.js — 'Hydration failed' due to differences in date and time zone

Description of the diagnosis and repair of the Hydration failed error in Next.js, when different representations of the date/time zone between the server and the client cause a discrepancy of the DOM tree and the hydratation errors.

Read the solution

Next.js 15: reading params.slug without await generates an error

After the Next.js update, the dynamic route begins to report that the params should be read asynchronously.

Read the solution

Next.js API endpoint returns 405 for OPTIONS method

The app tries to send a request from another domain, but endpoint corresponds to Method Not Allowed during preflight.

Read the solution

Next.js Image fill without sizes fetches too large file

On the phone, the graphics take a small portion of the screen, but the browser downloads a wide image for desktop.

Read the solution

Next.js Image returns 400 despite the correct image

The normal image URL works, but the / next/image request ends with HTTP 400.

Read the solution

Next.js Image: hostname is not configured under images — repair

Next/image rejects a photo from an outside host? Configure remotePatterns without opening the optimizer to all domains.

Read the solution

Next.js Link: href is required when rendering the list

The list of guides works for some of the records, but the render of one item with Link ends up with an error of missing href.

Read the solution

Next.js Middleware creates a redirect loop on /login

The browser informs about too many redirections and the login route does not open.

Read the solution

Next.js next/font: Failed to fetch Google Fonts during build

The implementation interrupts the compilation when downloading fonts by next/font/google.

Read the solution

Next.js notFound() ends as a 500 error after an exception has been caught

The non-existent article should return 404, but the catch turns the internal notFound() into a simple application error.

Read the solution

Next.js opengraph-image generates 500 when sharing a link

The page opens normally, but endpoint /opengraph-image returns 500 and the thumbnail in the communicator does not work.

Read the solution

Next.js parallel routes: After refresh the modal turns into 404

The navigation in the app opens modal, but a direct refresh of the current URL shows no matching of the parallel route.

Read the solution

Next.js revalidatePath Does Not Refresh a Specific Page

After performing the revalidatePath action, the user still sees a buffered version of the order details.

Read the solution

Next.js Route Handler GET returns old JSON after upgrade

After changing the configuration endpoint /api/config shows the previous values, although the database has new data.

Read the solution

Next.js Route Handler: Body is unusable at second read request.json()

Endpoint returns Body is unusable or stream already read when trying to reread POST data.

Read the solution

Next.js router.refresh() does not refresh data from the list

After saving the router.refresh record, it does not show a new value despite the completed POST.

Read the solution

Next.js Server Action rejects larger form or attachment

A small form works and sending more fields or a file ends in a request size limit error.

Read the solution

Next.js Server Action: Origin Mismatch Error

Writing through the form does not work only behind reverse proxy or custom domain and a message about origin mismatch appears.

Read the solution

Next.js shows old data despite updating in the database — cache

Old content in Next.js App Router? How to distinguish cache, static rendering and API problem.

Read the solution

Next.js sitemap contains preview addresses instead of production domain

Sitemap XML works, but its loc elements indicate the temporary domain of deploya Vercel.

Read the solution

Next.js Static Export: Dynamic Route Missing generateStaticParams

Output project: export is built until it passes through the dynamic route and reports missing generationStaticParams.

Read the solution

Next.js trailingSlash Causes a Redirect Loop

Request /offer passes through another 308 and returns to the previous address.

Read the solution

Next.js: Content Security Policy blocks application scripts

The browser shows Refused to execute inline script and part of the interaction does not work after sharpening CSP.

Read the solution
All English guides
Next.js, React and TypeScript — troubleshooting and solutions