Home
Support Forums

Getting error - Site deploy failed (nextjs - ghost API)

Hello.

I have setup a website using next.js on the front and fetching posts on a blog page from ghost API.
I installed the plugins needed and i get a build error:

12:42:51 PM: $ next build
12:42:52 PM: warn  - No build cache found. Please configure build caching for faster rebuilds. Read more: https://err.sh/next.js/no-cache
12:42:52 PM: info  - Creating an optimized production build...
12:42:57 PM: info  - Using external babel configuration from /opt/build/repo/.babelrc.json
12:43:12 PM: warn  - Compiled with warnings
12:43:12 PM: ./node_modules/next/dist/next-server/server/load-components.js
12:43:12 PM: Critical dependency: the request of a dependency is an expression
12:43:12 PM: ./node_modules/next/dist/next-server/server/load-components.js
12:43:12 PM: Critical dependency: the request of a dependency is an expression
12:43:12 PM: ./node_modules/next/dist/next-server/server/require.js
12:43:12 PM: Critical dependency: the request of a dependency is an expression
12:43:12 PM: ./node_modules/next/dist/next-server/server/require.js
12:43:12 PM: Critical dependency: the request of a dependency is an expression
12:43:12 PM: ./node_modules/next/dist/next-server/server/require.js
12:43:12 PM: Critical dependency: the request of a dependency is an expression
12:43:12 PM: ./node_modules/node-fetch/lib/index.js
12:43:12 PM: Module not found: Can't resolve 'encoding' in '/opt/build/repo/node_modules/node-fetch/lib'
12:43:12 PM: info  - Collecting page data...
12:43:13 PM: info  - Generating static pages (0/7)
12:43:14 PM: Unhandled error during request: TypeError: Only absolute URLs are supported
12:43:14 PM:     at getNodeRequestOptions (/opt/build/repo/node_modules/node-fetch/lib/index.js:1305:9)
12:43:14 PM:     at /opt/build/repo/node_modules/node-fetch/lib/index.js:1410:19
12:43:14 PM:     at new Promise (<anonymous>)
12:43:14 PM:     at fetch (/opt/build/repo/node_modules/node-fetch/lib/index.js:1407:9)
12:43:14 PM:     at getPosts (/opt/build/repo/.next/serverless/pages/blog.js:9700:21)
12:43:14 PM:     at getStaticProps (/opt/build/repo/.next/serverless/pages/blog.js:9708:23)
12:43:14 PM:     at renderToHTML (/opt/build/repo/.next/serverless/pages/blog.js:272:115)
12:43:14 PM:     at async renderReqToHTML (/opt/build/repo/.next/serverless/pages/blog.js:2719:334)
12:43:14 PM:     at async Object.exportPage [as default] (/opt/build/repo/node_modules/next/dist/export/worker.js:12:92)
12:43:14 PM: Error occurred prerendering page "/blog". Read more: https://err.sh/next.js/prerender-error
12:43:14 PM: TypeError: Only absolute URLs are supported
12:43:14 PM:     at getNodeRequestOptions (/opt/build/repo/node_modules/node-fetch/lib/index.js:1305:9)
12:43:14 PM:     at /opt/build/repo/node_modules/node-fetch/lib/index.js:1410:19
12:43:14 PM:     at new Promise (<anonymous>)
12:43:14 PM:     at fetch (/opt/build/repo/node_modules/node-fetch/lib/index.js:1407:9)
12:43:14 PM:     at getPosts (/opt/build/repo/.next/serverless/pages/blog.js:9700:21)
12:43:14 PM:     at getStaticProps (/opt/build/repo/.next/serverless/pages/blog.js:9708:23)
12:43:14 PM:     at renderToHTML (/opt/build/repo/.next/serverless/pages/blog.js:272:115)
12:43:14 PM:     at async renderReqToHTML (/opt/build/repo/.next/serverless/pages/blog.js:2719:334)
12:43:14 PM:     at async Object.exportPage [as default] (/opt/build/repo/node_modules/next/dist/export/worker.js:12:92)
12:43:14 PM: info  - Generating static pages (1/7)
12:43:14 PM: info  - Generating static pages (3/7)
12:43:14 PM: info  - Generating static pages (5/7)
12:43:14 PM: info  - Generating static pages (7/7)
12:43:14 PM: > Build error occurred
12:43:14 PM: Error: Export encountered errors on following paths:
12:43:14 PM: 	/blog
12:43:14 PM:     at exportApp (/opt/build/repo/node_modules/next/dist/export/index.js:30:1103)
12:43:14 PM:     at processTicksAndRejections (internal/process/task_queues.js:97:5)
12:43:14 PM:     at async /opt/build/repo/node_modules/next/dist/build/index.js:39:69
12:43:14 PM:     at async /opt/build/repo/node_modules/next/dist/build/tracer.js:1:525
12:43:14 PM: ​
12:43:14 PM: ────────────────────────────────────────────────────────────────
12:43:14 PM:   "build.command" failed                                        
12:43:14 PM: ────────────────────────────────────────────────────────────────
12:43:14 PM: ​
12:43:14 PM:   Error message
12:43:14 PM:   Command failed with exit code 1: next build
12:43:14 PM: ​
12:43:14 PM:   Error location
12:43:14 PM:   In Build command from Netlify app:
12:43:14 PM:   next build
12:43:14 PM: ​
12:43:14 PM:   Resolved config
12:43:14 PM:   build:
12:43:14 PM:     command: next build
12:43:14 PM:     commandOrigin: ui
12:43:14 PM:     environment:
12:43:14 PM:       - INCOMING_HOOK_BODY
12:43:14 PM:       - INCOMING_HOOK_TITLE
12:43:14 PM:       - INCOMING_HOOK_URL
12:43:14 PM:   plugins:
12:43:14 PM:     - inputs: {}
12:43:14 PM:       origin: ui
12:43:14 PM:       package: '@netlify/plugin-nextjs'
12:43:14 PM:     - inputs: {}
12:43:14 PM:       origin: ui
12:43:14 PM:       package: netlify-plugin-cache-nextjs

Hiya, sorry you are having trouble with your build.

This Support Guide contains a ton of useful debugging tips that can likely help you solve your problem :slight_smile:

We also recommend trying to search the forums with the build error you encountered - it’s likely your question was already asked by someone else!

If you are still having problems, please provide as much information as you can on what you have already tried, what your build settings are, your package.json, etc. Thanks!