Build issue when i try to deploy my website

Hello, I am encountering this build error when I deploy my next js site :

11:28:14 AM: info - Generating static pages (19/19)
11:28:14 AM: > Build error occurred
11:28:14 AM: Error: Export encountered errors on following paths:
11:28:14 AM: /
11:28:14 AM: at /opt/build/repo/node_modules/next/dist/export/index.js:404:19
11:28:14 AM: at runMicrotasks ()
11:28:14 AM: at processTicksAndRejections (node:internal/process/task_queues:96:5)
11:28:14 AM: at async Span.traceAsyncFn (/opt/build/repo/node_modules/next/dist/trace/trace.js:79:20)
11:28:14 AM: at async /opt/build/repo/node_modules/next/dist/build/index.js:1229:21
11:28:14 AM: at async Span.traceAsyncFn (/opt/build/repo/node_modules/next/dist/trace/trace.js:79:20)
11:28:14 AM: at async /opt/build/repo/node_modules/next/dist/build/index.js:1091:17
11:28:14 AM: at async Span.traceAsyncFn (/opt/build/repo/node_modules/next/dist/trace/trace.js:79:20)
11:28:14 AM: at async Object.build [as default] (/opt/build/repo/node_modules/next/dist/build/index.js:65:29)
11:28:14 AM: ​
11:28:14 AM: ────────────────────────────────────────────────────────────────
11:28:14 AM: “build.command” failed
11:28:14 AM: ────────────────────────────────────────────────────────────────
11:28:14 AM: ​
11:28:14 AM: Error message
11:28:14 AM: Command failed with exit code 1: npm run build (Search results for '"non-zero exit code: 1"' - Netlify Support Forums)
11:28:14 AM: ​
11:28:14 AM: Error location
11:28:14 AM: In Build command from Netlify app:
11:28:14 AM: npm run build
11:28:14 AM: ​
11:28:14 AM: Resolved config
11:28:14 AM: build:
11:28:14 AM: command: npm run build
11:28:14 AM: commandOrigin: ui
11:28:14 AM: environment:
11:28:14 AM: - NEXT_PRIVATE_TARGET
11:28:14 AM: publish: /opt/build/repo/.next
11:28:14 AM: publishOrigin: ui
11:28:14 AM: plugins:
11:28:14 AM: - inputs: {}
11:28:14 AM: origin: ui
11:28:14 AM: package: ‘@netlify/plugin-nextjs’
11:28:15 AM: Caching artifacts
11:28:15 AM: Started saving node modules
11:28:15 AM: Finished saving node modules
11:28:15 AM: Started saving build plugins
11:28:15 AM: Finished saving build plugins
11:28:15 AM: Started saving pip cache
11:28:15 AM: Finished saving pip cache
11:28:15 AM: Started saving emacs cask dependencies
11:28:15 AM: Finished saving emacs cask dependencies
11:28:15 AM: Started saving maven dependencies
11:28:15 AM: Finished saving maven dependencies
11:28:15 AM: Started saving boot dependencies
11:28:15 AM: Finished saving boot dependencies
11:28:15 AM: Started saving rust rustup cache
11:28:15 AM: Finished saving rust rustup cache
11:28:15 AM: Started saving go dependencies
11:28:15 AM: Finished saving go dependencies
11:28:15 AM: Build failed due to a user error: Build script returned non-zero exit code: 2
11:28:16 AM: Creating deploy upload records
11:28:16 AM: Failing build: Failed to build site
11:28:16 AM: Failed during stage ‘building site’: Build script returned non-zero exit code: 2 (Search results for '"non-zero exit code: 2"' - Netlify Support Forums)
11:28:16 AM: Finished processing build request in 59.324348411s

I have no idea on how to fix this error. Do you have any suggestion ?

Thanks

hi @amzzor

Can you please share the Deploy ID for that broken build, please?

You can take that from the URL itself, being the last ID on that URL.

Thanks

Sure @gualter : 6346cec3d89fce000972ac03

Hi @amzzor

The error seems to be coming from the page generation stage:

Error occurred prerendering page "/". Read more: https://nextjs.org/docs/messages/prerender-error
3:28:14 PM: TypeError: Only absolute URLs are supported
3:28:14 PM:     at getNodeRequestOptions (/opt/build/repo/node_modules/next/dist/compiled/node-fetch/index.js:1:63531)
3:28:14 PM:     at /opt/build/repo/node_modules/next/dist/compiled/node-fetch/index.js:1:65062
3:28:14 PM:     at new Promise (<anonymous>)
3:28:14 PM:     at Function.fetch [as default] (/opt/build/repo/node_modules/next/dist/compiled/node-fetch/index.js:1:64996)
3:28:14 PM:     at fetchWithAgent (/opt/build/repo/node_modules/next/dist/server/node-polyfill-fetch.js:53:39)
3:28:14 PM:     at storefront (/opt/build/repo/.next/server/chunks/313.js:14:28)
3:28:14 PM:     at getStaticProps (/opt/build/repo/.next/server/pages/index.js:996:89)
3:28:14 PM:     at renderToHTML (/opt/build/repo/node_modules/next/dist/server/render.js:386:26)
3:28:14 PM:     at async /opt/build/repo/node_modules/next/dist/export/worker.js:304:36
3:28:14 PM:     at async Span.traceAsyncFn (/opt/build/repo/node_modules/next/dist/trace/trace.js:79:20)

Are you using relative URLs anywhere? Do you mind sharing your implementation of this, please?

I found the problem. I was calling a prop to test very old things and i forgot to remove it.

Now it works well, thanks !