Open coreyasmith opened 1 year ago
Hi @coreyasmith ! Thanks for the report!
This one is a pesky issue that comes and goes on occasion, we'll re-verify it and update here.
This has been automatically marked as stale because it has not had recent activity. It will be closed if there is no further activity within 30 days. You may add comments or the 'keep' label to prevent it from closing. Thank you for your contributions.
I just experienced this issue.
Describe the Bug
When a new Headless SXA site is created using GraphQL, the Dictionary Service fails to auto-resolve the app root item with the following error:
To Reproduce
Create a new Headless SXA site using GraphQL to fetch the Layout and Dictionary data.
Expected Behavior
Headless SXA site is auto-resolved.
Possible Fix
When no
rootItemId
is specified in theGraphQLDictionaryService
in\src\lib\dictionary-service-factory.ts
, the Dictionary Service attempts to resolve the root item ID by querying Sitecore for items that inherit from the Headless ServicesApp
template (/sitecore/templates/Foundation/JavaScript Services/App
): https://github.com/Sitecore/jss/blob/1a2234236ab5ab5bb5e19a575d219fce6887ed32/packages/sitecore-jss/src/graphql/app-root-query.ts#L65The Headless SXA
Headless Site
template (/sitecore/templates/Foundation/JSS Experience Accelerator/Multisite/Headless Site
) does not inherit the Headless ServicesApp
template, so Headless SXA sites cannot be auto-resolved.To fix this issue, either:
getAppRootId
query to include theHeadless Site
template (9ed6640464c9412290e1869cb3cea566
) when nojssAppTemplateId
is specified; orHeadless Site
template to inherit the Headless ServicesApp
template.Based on #1409, it appears this has already been fixed using the second approach in XM Cloud.
Workaround
Teams affected by this issue that only have SXA Headless sites can fix the issue by adding
jssAppTemplateId: '9ed6640464c9412290e1869cb3cea566'
(the ID of the SXAHeadless Site
template) to theGraphQLDictionaryService
in\src\lib\dictionary-service-factory.ts
like so:Teams that have both SXA Headless sites and "vanilla" Headless Services sites, and wish to share the same app between those sites with the
nextjs-multisite
module, will need to update the SXAHeadless Site
template in Sitecore to inherit from the Headless ServicesApp
template and should not specify thejssAppTemplateId
.Provide environment information