Hey There,
We are running a next.js build on the newest version and keep running into a fetch error. We have tried several different techniques to get this to work without any luck.
The build fails about every 5-7 times seemingly random.
Could this be a problem with the API or the domain? Or is this an issue with Netlify/NextJS?
Any guidance would be appreciated! Below you will find the deploy details.
11:49:20 AM: 1. @netlify/plugin-nextjs (onPreBuild event)
11:49:20 AM: ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
11:49:20 AM: β
11:49:20 AM: Next.js cache restored.
11:49:20 AM: Netlify configuration property "build.environment.NEXT_PRIVATE_TARGET" value changed.
11:49:20 AM: β
11:49:20 AM: (@netlify/plugin-nextjs onPreBuild completed in 429ms)
11:49:20 AM: β
11:49:20 AM: ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
11:49:20 AM: 2. netlify-plugin-cache-nextjs (onPreBuild event)
11:49:20 AM: ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
11:49:20 AM: β
11:49:20 AM: .next/cache exists on disk
11:49:20 AM: Restored the cached .next folder at the location .next/cache
11:49:20 AM: β
11:49:20 AM: (netlify-plugin-cache-nextjs onPreBuild completed in 297ms)
11:49:20 AM: β
11:49:20 AM: ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
11:49:20 AM: 3. build.command from netlify.toml
11:49:20 AM: ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
11:49:20 AM: β
11:49:20 AM: $ npm run build
11:49:21 AM: > next-js-boilerplate@1.0.0 build
11:49:21 AM: > next build
11:49:22 AM: info - Checking validity of types...
11:49:40 AM: warn - The Next.js plugin was not detected in your ESLint configuration. See https://nextjs.org/docs/basic-features/eslint#migrating-existing-config
11:49:53 AM: ./src/pages/_document.tsx
11:49:53 AM: 23:29 Warning: Dangerous property 'dangerouslySetInnerHTML' found react/no-danger
11:49:53 AM: info - Need to disable some ESLint rules? Learn more here: https://nextjs.org/docs/basic-features/eslint#disabling-rules
11:49:53 AM: info - Creating an optimized production build...
11:49:53 AM: info - Disabled SWC as replacement for Babel because of custom Babel configuration ".babelrc" https://nextjs.org/docs/messages/swc-disabled
11:49:55 AM: warn - You have enabled the JIT engine which is currently in preview.
11:49:55 AM: warn - Preview features are not covered by semver, may introduce breaking changes, and can change at any time.
11:49:57 AM: info - Using external babel configuration from /opt/build/repo/.babelrc
11:50:12 AM: info - Compiled successfully
11:50:12 AM: info - Collecting page data...
11:50:16 AM: info - Generating static pages (0/456)
11:50:23 AM: Error occurred prerendering page "/jobs/view/postal-clerk-holiday-season-from-nov-15-to-jan-15". Read more: https://nextjs.org/docs/messages/prerender-error
11:50:23 AM: FetchError: request to https://api.benecms.com/rest/skillscentre/Jobs/postal-clerk-holiday-season-from-nov-15-to-jan-15 failed, reason: read ECONNRESET
11:50:23 AM: at ClientRequest.<anonymous> (/opt/build/repo/node_modules/node-fetch/lib/index.js:1461:11)
11:50:23 AM: at ClientRequest.emit (node:events:390:28)
11:50:23 AM: at TLSSocket.socketErrorListener (node:_http_client:447:9)
11:50:23 AM: at TLSSocket.emit (node:events:390:28)
11:50:23 AM: at emitErrorNT (node:internal/streams/destroy:157:8)
11:50:23 AM: at emitErrorCloseNT (node:internal/streams/destroy:122:3)
11:50:23 AM: at processTicksAndRejections (node:internal/process/task_queues:83:21)
11:50:25 AM: info - Generating static pages (114/456)
11:50:32 AM: info - Generating static pages (228/456)
11:50:39 AM: info - Generating static pages (342/456)
11:50:46 AM: info - Generating static pages (456/456)
11:50:46 AM: > Build error occurred
11:50:46 AM: Error: Export encountered errors on following paths:
11:50:46 AM: /jobs/view/[id]: /jobs/view/postal-clerk-holiday-season-from-nov-15-to-jan-15
11:50:46 AM: at /opt/build/repo/node_modules/next/dist/export/index.js:500:19
11:50:46 AM: at runMicrotasks (<anonymous>)
11:50:46 AM: at processTicksAndRejections (node:internal/process/task_queues:96:5)
11:50:46 AM: at async Span.traceAsyncFn (/opt/build/repo/node_modules/next/dist/trace/trace.js:75:20)
11:50:46 AM: at async /opt/build/repo/node_modules/next/dist/build/index.js:1006:17
11:50:46 AM: at async Span.traceAsyncFn (/opt/build/repo/node_modules/next/dist/trace/trace.js:75:20)
11:50:46 AM: at async /opt/build/repo/node_modules/next/dist/build/index.js:880:13
11:50:46 AM: at async Span.traceAsyncFn (/opt/build/repo/node_modules/next/dist/trace/trace.js:75:20)
11:50:46 AM: at async Object.build [as default] (/opt/build/repo/node_modules/next/dist/build/index.js:82:25)
11:50:46 AM: β
11:50:46 AM: ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
11:50:46 AM: "build.command" failed
11:50:46 AM: ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
11:50:46 AM: β
11:50:46 AM: Error message
11:50:46 AM: Command failed with exit code 1: npm run build
11:50:46 AM: β
11:50:46 AM: Error location
11:50:46 AM: In build.command from netlify.toml:
11:50:46 AM: npm run build
11:50:46 AM: β
11:50:46 AM: Resolved config
11:50:46 AM: build:
11:50:46 AM: command: npm run build
11:50:46 AM: commandOrigin: config
11:50:46 AM: environment:
11:50:46 AM: - ALGOLIA_API_KEY
11:50:46 AM: - ALGOLIA_BASE_URL
11:50:46 AM: - NEXT_PRIVATE_TARGET
11:50:46 AM: publish: /opt/build/repo/.next
11:50:46 AM: publishOrigin: config
11:50:46 AM: plugins:
11:50:46 AM: - inputs: {}
11:50:46 AM: origin: ui
11:50:46 AM: package: '@algolia/netlify-plugin-crawler'
11:50:46 AM: - inputs:
11:50:46 AM: prettyURLs: true
11:50:46 AM: trailingSlash: true
11:50:46 AM: origin: config
11:50:46 AM: package: '@netlify/plugin-sitemap'
11:50:46 AM: - inputs: {}
11:50:46 AM: origin: config
11:50:46 AM: package: '@netlify/plugin-nextjs'
11:50:46 AM: - inputs: {}
11:50:46 AM: origin: config
11:50:46 AM: package: netlify-plugin-cache-nextjs
11:50:47 AM: Caching artifacts
11:50:47 AM: Started saving node modules
11:50:47 AM: Finished saving node modules
11:50:47 AM: Started saving build plugins
11:50:47 AM: Finished saving build plugins
11:50:47 AM: Started saving pip cache
11:50:47 AM: Finished saving pip cache
11:50:47 AM: Started saving emacs cask dependencies
11:50:47 AM: Finished saving emacs cask dependencies
11:50:47 AM: Started saving maven dependencies
11:50:47 AM: Finished saving maven dependencies
11:50:47 AM: Started saving boot dependencies
11:50:47 AM: Finished saving boot dependencies
11:50:47 AM: Started saving rust rustup cache
11:50:47 AM: Finished saving rust rustup cache
11:50:47 AM: Started saving go dependencies
11:50:47 AM: Finished saving go dependencies
11:50:47 AM: Build failed due to a user error: Build script returned non-zero exit code: 2
11:50:47 AM: Creating deploy upload records
11:50:47 AM: Failing build: Failed to build site
11:50:47 AM: Failed during stage 'building site': Build script returned non-zero exit code: 2
11:50:47 AM: Finished processing build request in 1m57.887791566s