You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
Error: Valid value for rootItemId not provided and failed to auto-resolve app root item.
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 the GraphQLDictionaryService 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 Services App template (/sitecore/templates/Foundation/JavaScript Services/App):
The Headless SXA Headless Site template (/sitecore/templates/Foundation/JSS Experience Accelerator/Multisite/Headless Site) does not inherit the Headless Services App template, so Headless SXA sites cannot be auto-resolved.
To fix this issue, either:
Update the getAppRootId query to include the Headless Site template (9ed6640464c9412290e1869cb3cea566) when no jssAppTemplateId is specified; or
Update SXA's Headless Site template to inherit the Headless Services App 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 SXA Headless Site template) to the GraphQLDictionaryService 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 SXA Headless Site template in Sitecore to inherit from the Headless Services App template and should not specify the jssAppTemplateId.
Provide environment information
Sitecore Version: 10.3
JSS Version: 21.2.1
Browser Name and version: Firefox 114.0.2
Operating System and version (desktop or mobile): Windows 11 22H2 (22621.1928)
Link to your project (if available): N/A
The text was updated successfully, but these errors were encountered:
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.
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
):jss/packages/sitecore-jss/src/graphql/app-root-query.ts
Line 65 in 1a22342
The 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
The text was updated successfully, but these errors were encountered: