I've modified the promotion page to filter products directly on the server instead of using the client-side filterProducts function. This should resolve the prerendering error during deployment. The page will now work correctly with Next.js's server-side rendering.
The key changes are:
This ensures that all data is available during the build process and prevents any client-side code from running during server-side rendering.
I've updated the search page to:
These changes should resolve the prerendering error for the search page while maintaining all functionality. The page will now be rendered entirely on the client side, which is appropriate for a search page that depends on user input.
I get this:
[19:14:04.171] Running build in Washington, D.C., USA (East) – iad1
[19:14:04.277] Retrieving list of deployment files...
[19:14:04.581] Previous build cache not available
[19:14:04.722] Downloading 87 deployment files...
[19:14:05.362] Running "vercel build"
[19:14:05.787] Vercel CLI 39.2.0
[19:14:06.658] Running "install" command: `bun install`...
[19:14:06.693] bun install v1.1.38 (bf2f153f)
[19:14:06.706] Resolving dependencies
[19:14:09.446] Resolved, downloaded and extracted [1042]
[19:14:09.446] warn: incorrect peer dependency "date-fns@4.1.0"
[19:14:09.734] Saved lockfile
[19:14:09.734]
[19:14:09.734] + @types/node@22.10.5
[19:14:09.734] + @types/react@18.3.18 (v19.0.3 available)
[19:14:09.734] + @types/react-dom@18.3.5 (v19.0.2 available)
[19:14:09.735] + postcss@8.4.49
[19:14:09.735] + tailwindcss@3.4.17
[19:14:09.735] + typescript@5.7.2
[19:14:09.735] + @hookform/resolvers@3.9.1
[19:14:09.735] + @radix-ui/react-accordion@1.2.2
[19:14:09.736] + @radix-ui/react-alert-dialog@1.1.4
[19:14:09.736] + @radix-ui/react-aspect-ratio@1.1.1
[19:14:09.736] + @radix-ui/react-avatar@1.1.2
[19:14:09.736] + @radix-ui/react-checkbox@1.1.3
[19:14:09.736] + @radix-ui/react-collapsible@1.1.2
[19:14:09.736] + @radix-ui/react-context-menu@2.2.4
[19:14:09.736] + @radix-ui/react-dialog@1.1.4
[19:14:09.736] + @radix-ui/react-dropdown-menu@2.1.4
[19:14:09.736] + @radix-ui/react-hover-card@1.1.4
[19:14:09.736] + @radix-ui/react-label@2.1.1
[19:14:09.736] + @radix-ui/react-menubar@1.1.4
[19:14:09.736] + @radix-ui/react-navigation-menu@1.2.3
[19:14:09.736] + @radix-ui/react-popover@1.1.4
[19:14:09.736] + @radix-ui/react-progress@1.1.1
[19:14:09.736] + @radix-ui/react-radio-group@1.2.2
[19:14:09.736] + @radix-ui/react-scroll-area@1.2.2
[19:14:09.736] + @radix-ui/react-select@2.1.4
[19:14:09.736] + @radix-ui/react-separator@1.1.1
[19:14:09.736] + @radix-ui/react-slider@1.2.2
[19:14:09.736] + @radix-ui/react-slot@1.1.1
[19:14:09.736] + @radix-ui/react-switch@1.1.2
[19:14:09.736] + @radix-ui/react-tabs@1.1.2
[19:14:09.736] + @radix-ui/react-toast@1.2.4
[19:14:09.736] + @radix-ui/react-toggle@1.1.1
[19:14:09.737] + @radix-ui/react-toggle-group@1.1.1
[19:14:09.737] + @radix-ui/react-tooltip@1.1.6
[19:14:09.737] + autoprefixer@10.4.20
[19:14:09.737] + class-variance-authority@0.7.1
[19:14:09.737] + clsx@2.1.1
[19:14:09.737] + cmdk@1.0.4
[19:14:09.737] + date-fns@4.1.0
[19:14:09.737] + embla-carousel-react@8.5.1
[19:14:09.737] + input-otp@1.4.1 (v1.4.2 available)
[19:14:09.737] + lucide-react@0.454.0 (v0.469.0 available)
[19:14:09.737] + next@14.2.16 (v15.1.3 available)
[19:14:09.737] + next-themes@0.4.4
[19:14:09.737] + react@18.3.1 (v19.0.0 available)
[19:14:09.737] + react-day-picker@8.10.1 (v9.5.0 available)
[19:14:09.737] + react-dom@18.3.1 (v19.0.0 available)
[19:14:09.737] + react-hook-form@7.54.2
[19:14:09.737] + react-resizable-panels@2.1.7
[19:14:09.737] + recharts@2.15.0
[19:14:09.737] + sonner@1.7.1
[19:14:09.737] + tailwind-merge@2.6.0
[19:14:09.737] + tailwindcss-animate@1.0.7
[19:14:09.737] + vaul@0.9.9 (v1.1.2 available)
[19:14:09.737] + zod@3.24.1
[19:14:09.737]
[19:14:09.737] 261 packages installed [3.06s]
[19:14:09.778] Detected Next.js version: 14.2.16
[19:14:09.779] Running "bun run build"
[19:14:09.785] $ next build
[19:14:10.592] Attention: Next.js now collects completely anonymous telemetry regarding usage.
[19:14:10.593] This information is used to shape Next.js' roadmap and prioritize features.
[19:14:10.593] You can learn more, including how to opt-out if you'd not like to participate in this anonymous program, by visiting the following URL:
[19:14:10.593] https://nextjs.org/telemetry
[19:14:10.593]
[19:14:10.657] ▲ Next.js 14.2.16
[19:14:10.657] - Experiments (use with caution):
[19:14:10.657] · webpackBuildWorker
[19:14:10.657] · parallelServerCompiles
[19:14:10.657] · parallelServerBuildTraces
[19:14:10.657]
[19:14:10.735] Creating an optimized production build ...
[19:14:12.860] (node:114) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
[19:14:12.860] (Use `node --trace-deprecation ...` to show where the warning was created)
[19:14:19.584] (node:175) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
[19:14:19.585] (Use `node --trace-deprecation ...` to show where the warning was created)
[19:14:25.434] ✓ Compiled successfully
[19:14:25.435] Skipping validation of types
[19:14:25.435] Skipping linting
[19:14:25.886] Collecting page data ...
[19:14:26.600] Generating static pages (0/6) ...
[19:14:26.687] ⨯ useSearchParams() should be wrapped in a suspense boundary at page "/search". Read more: https://nextjs.org/docs/messages/missing-suspense-with-csr-bailout
[19:14:26.687] at o (/vercel/path1/.next/server/chunks/801.js:1:10674)
[19:14:26.688] at c (/vercel/path1/.next/server/chunks/801.js:1:21614)
[19:14:26.688] at x (/vercel/path1/.next/server/app/search/page.js:1:1688)
[19:14:26.688] at nj (/vercel/path1/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:46251)
[19:14:26.688] at nM (/vercel/path1/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:47571)
[19:14:26.688] at nN (/vercel/path1/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:64546)
[19:14:26.688] at nI (/vercel/path1/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:47010)
[19:14:26.688] at nM (/vercel/path1/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:47717)
[19:14:26.688] at nM (/vercel/path1/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:61546)
[19:14:26.688] at nN (/vercel/path1/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:64546)
[19:14:26.689] Generating static pages (1/6)
[19:14:26.690]
[19:14:26.690] Error occurred prerendering page "/search". Read more: https://nextjs.org/docs/messages/prerender-error
[19:14:26.690]
[19:14:26.691] Generating static pages (2/6)
[19:14:26.756] Generating static pages (4/6)
[19:14:26.926] ✓ Generating static pages (6/6)
[19:14:26.935]
[19:14:26.935] > Export encountered errors on following paths:
[19:14:26.935] /search/page: /search
[19:14:26.949] error: script "build" exited with code 1
[19:14:26.958] Error: Command "bun run build" exited with 1
[19:14:27.323]