I'm having problems building because of next
on00dev
HOBBYOP

10 months ago

install apt packages: build-essential g++ libsqlite3-dev make nodejs npm python3

31s

Unpacking libquadmath0:amd64 (12.2.0-14+deb12u1) ...

[...]

install apt packages: build-essential g++ libsqlite3-dev make nodejs npm python3

31s

Unpacking node-babel-plugin-polyfill-regenerator (0.4.1~0~20220913+ds1-1) ...

cd app && npm install && npm run export

31s

⚠ Specified "rewrites" will not automatically work with "output: export". See more info here: https://nextjs.org/docs/messages/export-no-custom-routes

⚠ Specified "rewrites" will not automatically work with "output: export". See more info here: https://nextjs.org/docs/messages/export-no-custom-routes

✓ Compiled successfully

Linting and checking validity of types ...

error - Your project has an older version of ESLint installed (6.4.0). Please upgrade to ESLint version 7 or above

Collecting page data ...

Generating static pages (0/7) ...

⨯ useSearchParams() should be wrapped in a suspense boundary at page "/play". Read more: https://nextjs.org/docs/messages/missing-suspense-with-csr-bailout

at a (/app/app/.next/server/chunks/825.js:5:40911)

at f (/app/app/.next/server/chunks/825.js:3:19482)

at i (/app/app/.next/server/app/play/page.js:1:2848)

at nL (/app/app/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:76:46773)

at nF (/app/app/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:76:48548)

at nq (/app/app/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:76:67434)

at nH (/app/app/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:76:65009)

at nU (/app/app/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:76:47125)

at nF (/app/app/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:76:48594)

at nF (/app/app/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:76:64360)

Error occurred prerendering page "/play". Read more: https://nextjs.org/docs/messages/prerender-error

Export encountered an error on /play/page: /play, exiting the build.

⨯ Next.js build worker exited with code: 1 and signal: null

ERROR: failed to build: failed to solve: process "sh -c cd app && npm install && npm run export" did not complete successfully: exit code: 1

Solved$10 Bounty

Pinned Solution

starphoneswebtech
PRO

10 months ago

The error occurs because useSearchParams() is a client-side hook in Next.js, and it must be wrapped within a <Suspense> boundary when used inside a Server Component.

A simple solution is to move the logic using useSearchParams() into a separate component and add 'use client' at the top of that file.

This issue is code-related, so it’s a good idea to run a production build locally before deploying to catch and resolve such errors in advance.

3 Replies

starphoneswebtech
PRO

10 months ago

The error occurs because useSearchParams() is a client-side hook in Next.js, and it must be wrapped within a <Suspense> boundary when used inside a Server Component.

A simple solution is to move the logic using useSearchParams() into a separate component and add 'use client' at the top of that file.

This issue is code-related, so it’s a good idea to run a production build locally before deploying to catch and resolve such errors in advance.


on00dev
HOBBYOP

10 months ago

Thank you so much bro.


starphoneswebtech

The error occurs because `useSearchParams()` is a client-side hook in Next.js, and it must be wrapped within a `<Suspense>` boundary when used inside a Server Component. A simple solution is to move the logic using `useSearchParams()` into a separate component and add `'use client'` at the top of that file. This issue is code-related, so it’s a good idea to run a production build locally before deploying to catch and resolve such errors in advance.

on00dev
HOBBYOP

10 months ago

What I did to fix this in the app/play route:

I created a dedicated client component that contains all the useSearchParams logic, effects, and UI:ClientPlay.tsx

I transformed the play route's page.tsx into a Server Component and started rendering the client component inside:page.tsx

The useSearchParams hook remains in a Client Component, and the page (Server Component) maintains compliance with the Next 13+ requirement for suspense for client hooks when rendered in the server context.

Thank you so much bro.


Status changed to Solved brody 11 months ago


Welcome!

Sign in to your Railway account to join the conversation.

Loading...