Sitecore / jss

Software development kit for JavaScript developers building web applications with Sitecore Experience Platform
https://jss.sitecore.com
Apache License 2.0
261 stars 275 forks source link

[NextJS] [ graphql-let ] graphql-codegen error #1282

Closed ominatu1 closed 1 year ago

ominatu1 commented 1 year ago

Description

graphql-codegen error after update GraphQL Introspection:

Step to reproduce: dotnet sitecore login --authority https://demo.identityserver.local --cm https://demo.cm.local --allow-write true jss graphql:update jss build

Expected behavior

"jss build" should successful but have error relate to graphql-codegen

[ graphql-let ] Running graphql-codegen... [ graphql-let ] Interface field Item.children expects type ItemSearchResults! but App.children is type ItemSearchResults. Interface field Item.children expects type ItemSearchResults! but CRoute.children is type ItemSearchResults. Interface field Item.children expects type ItemSearchResults! but CStandardTemplate.children is type ItemSearchResults.

Environment

image

larserhardsen commented 1 year ago

We see the same behavior, and it seems to be related to Headless Services 21 - version 20 does not appear to have this problem.

ambrauer commented 1 year ago

@donggach @larserhardsen Thanks for the information, I've added this to our backlog to investigate / fix in a future release.

bewards commented 1 year ago

What is the preferred workaround for this issue with SC 10.3 Headless 21? I had to disable all graphql files, which means graphql connected mode can't be used. Then I had to update the entrypoint for docker rendering and the nextjs app to a new start:connected command so that when it fails to find graphql files for graphql-let, it still passes through and let's the rendering app initialize:

"start:connected_continue-on-error": "npm run bootstrap & npm-run-all --parallel next:dev start:watch-components"
ambrauer commented 1 year ago

A hotfix for this issue is now available, upon request, for Sitecore XP 10.3 and Headless Services 21.0.0. Please reach out to Sitecore Support and they will be happy to assist. You can use reference number 572005 in your request.

If you are using Sitecore XM Cloud, this issue should be fixed in the latest version.

cc @ominatu1 @larserhardsen @bewards