0

When not using graphql feature npm run build fails with following error:

> Build error occurred
TypeError: Only absolute URLs are supported
    at getNodeRequestOptions (C:\Projects\TEMP\test-jss-next\node_modules\node-fetch\lib\index.js:1305:9)
    at C:\Projects\TEMP\test-jss-next\node_modules\node-fetch\lib\index.js:1410:19
    at new Promise (<anonymous>)
    at fetch (C:\Projects\TEMP\test-jss-next\node_modules\node-fetch\lib\index.js:1407:9)
    at fetch (C:\Projects\TEMP\test-jss-next\node_modules\cross-fetch\dist\node-ponyfill.js:10:20)
    at C:\Projects\TEMP\test-jss-next\node_modules\@sitecore-jss\sitecore-jss\node_modules\graphql-request\dist\index.js:123:42
    at step (C:\Projects\TEMP\test-jss-next\node_modules\@sitecore-jss\sitecore-jss\node_modules\graphql-request\dist\index.js:63:23)
    at Object.next (C:\Projects\TEMP\test-jss-next\node_modules\@sitecore-jss\sitecore-jss\node_modules\graphql-request\dist\index.js:44:53)
    at C:\Projects\TEMP\test-jss-next\node_modules\@sitecore-jss\sitecore-jss\node_modules\graphql-request\dist\index.js:38:71
    at new Promise (<anonymous>) {
  type: 'TypeError'
}

I expect to not have this error or have option to skip qraphql

Steps To Reproduce:

  • Run jss create test-jss-nextjs-app nextjs
  • Run cd test-jss-nextjs-app
  • Run npm run build

See this error

JSS Version: 18.0.0

Does anyone experience the same error? Who knows how to solve this issue?

1

With Next.js, running a build will trigger a production build, which requires a service to communicate with first. The build target by default then needs a running Sitecore instance configured in the scjssconfig.json.

What you want instead likely is npm run start, which will start the disconnected/mock Sitecore service and run Next.js in development mode against that.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.