Open GAAOPS opened 5 months ago
I found a workaround for the issue, to prevent the build issue when you want to disable the SSG, in your .env file:
DISABLE_SSG_FETCH=true
GRAPH_QL_ENDPOINT=http://nonexisting/
Just filling out GRAPH_QL_ENDPOINT
with something will solve the issue.
Nevertheless, it is a bug.
Thanks @GAAOPS for submitting this! We created an item in our backlog to look into it.
Describe the Bug
I have started a new project with Sitecore XM1, SXA and nextjs@22. Because of the network restriction I need to turn off the SSG during build process. After Setting
DISABLE_SSG_FETCH=true
the build is failing in three places:sitemapFetcher
, even if I remove the whole code fromgetStaticPaths
it still does not work. i need to removeimport { sitemapFetcher } from 'lib/sitemap-fetcher';
To Reproduce
Run:
npx create-sitecore-jss@^22.0.0 nextjs
with the following options:After it is finished, set the
DISABLE_SSG_FETCH=true
in the.env
file and runnpm run build
Expected Behavior
Setting the
DISABLE_SSG_FETCH=true
should prevent requests to the edge endpoint and the build should not fail.Possible Fix
I dont know how the first issue with sitemapFetcher can be fixed but for 404,500 pages there is an easy fix: the whole code inside the getStaticProps should be inside
if (!process.env.DISABLE_SSG_FETCH)
.Provide environment information