0

Steps I have followed so far:

npm i -g @sitecore-jss/[email protected]
jss create testapp nextjs --branch release/18.0.0
jss start
Add output:'export' in next.config.js file
npm run build - **This command throws the below error**
TypeError: Only absolute URLs are supported
    at getNodeRequestOptions (C:\Repos\JSS\testapp-jss\node_modules\node-fetch\lib\index.js:1305:9)
    at C:\Repos\JSS\testapp-jss\node_modules\node-fetch\lib\index.js:1410:19
    at new Promise ()
    at fetch (C:\Repos\JSS\testapp-jss\node_modules\node-fetch\lib\index.js:1407:9)
    at fetch (C:\Repos\JSS\testapp-jss\node_modules\cross-fetch\dist\node-ponyfill.js:10:20)
    at C:\Repos\JSS\testapp-jss\node_modules\graphql-request\dist\index.js:163:42
    at step (C:\Repos\JSS\testapp-jss\node_modules\graphql-request\dist\index.js:63:23)
    at Object.next (C:\Repos\JSS\testapp-jss\node_modules\graphql-request\dist\index.js:44:53)
    at C:\Repos\JSS\testapp-jss\node_modules\graphql-request\dist\index.js:38:71
    at new Promise () {
  type: 'TypeError'

Need help on this issue

1
  • Can you share your next-config.js file here Commented Jul 3, 2024 at 12:00

1 Answer 1

0

When you configure output: 'export', Next.js requires all URLs used in the project to be absolute. This is because static export doesn’t support relative URLs for API calls, as it expects all data to be fetched and available at build time. Double-check that any API calls or image paths are using absolute URLs.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.