1

I am trying to get started using Sitecore CLI on my Sitecore 10.1 project. I am using Sitecore CLI v5.2.113. When I try to run an info command, I get success so I am thinking my setup is okay. However, I am not able to pull. I get an error from the GraphQL API. I have tried suggestions from the few articles I found online, such as deleting my user.json and login to recreate it, and confirmed that identity and cM URLs are both https. Hopefully, someone can guide me? Thanks in advance.

PS A:\Code\sitecore-paas> dotnet sitecore --version
5.2.113+530fb34dbe030bda1abdb1f9db9cabc774e65ca5
PS A:\Code\sitecore-paas> dotnet sitecore plugin list
List of plugins:
[Installed] Sitecore.DevEx.Extensibility.Serialization v.5.2.113
[Installed] Sitecore.DevEx.Extensibility.Publishing v.5.2.113
[Installed] Sitecore.DevEx.Extensibility.Indexing v.5.2.113
[Installed] Sitecore.DevEx.Extensibility.ResourcePackage v.5.2.113
[Installed] Sitecore.DevEx.Extensibility.Database v.5.2.113
PS A:\Code\sitecore-paas>

PS A:\Code\sitecore-paas> dotnet sitecore ser info
Maximum subtree-relative item path allowed: 100

content
  Subtrees:
    content: /sitecore/content/path/to/user/Login
      FieldsFilter Excludes: 0
  Roles: 0
  Users: 0


PS A:\Code\sitecore-paas> dotnet sitecore ser pull -t -v --what-if
Looking for package [email protected]
Looking for package [email protected]
Looking for package [email protected]
Looking for package [email protected]
Looking for package [email protected]
Finished resolving plugins. Total elapsed resolution time: 968ms
What if mode is active. No changes will be made.
> Resolving modules from expressions:
  * ./folder/serialization/content/content.json
>> Resolved 1 local module(s) using glob(s)
  * ./folder/serialization/content/content.json
[master] Source: Sitecore endpoint default (Host: https://<CM hostname>/, DB: master)
[master] Destination: serialized items (1 subtrees)
[master] Loading data...
[master] FSIndex: Loaded filesystem indices in 16ms (0 metadatas)
[master] [GraphQL> Get metadata (master; 1 specs, ItemAndDescendants)] Sending GraphQL request 1
[master] [GraphQL> Get metadata (master; 1 specs, ItemAndDescendants)] [Version comparison] versionComparisonEnabled: True
[master] [GraphQL> Get metadata (master; 1 specs, ItemAndDescendants)] [Version comparison] Added sitecore-graphql-version-comparing-enabled: True
[master] [GraphQL> Get metadata (master; 1 specs, ItemAndDescendants)] [Version comparison] Added sitecore-graphql-cli-version: 5.2.113
[master] [GraphQL> Get metadata (master; 1 specs, ItemAndDescendants)] HTTP Error invoking GraphQL endpoint https://CM.hostname//sitecore/api/management
[master] [GraphQL> Get metadata (master; 1 specs, ItemAndDescendants)] Query 1:
query($aP: String! $aD: String! $aE: [String] $aS: TreeScope!) {
a:
  serialize(path: $aP, database: $aD, scope: $aS , excludedFieldIds : $aE) {
    id
    parentId
    templateId
    path
    hasChildren
    dataSignature
  }
}

[master] [GraphQL> Get metadata (master; 1 specs, ItemAndDescendants)] Query 1 variables: {
[master] [GraphQL> Get metadata (master; 1 specs, ItemAndDescendants)]   "aP": "/sitecore/content/path/to/user/Login",
[master] [GraphQL> Get metadata (master; 1 specs, ItemAndDescendants)]   "aD": "master",
[master] [GraphQL> Get metadata (master; 1 specs, ItemAndDescendants)]   "aE": [],
[master] [GraphQL> Get metadata (master; 1 specs, ItemAndDescendants)]   "aS": "ITEM_AND_DESCENDANTS"
[master] [GraphQL> Get metadata (master; 1 specs, ItemAndDescendants)] }
[GraphQLHttpException] Unexpected HttpResponseMessage with code: InternalServerError
   at GraphQL.Client.Http.Internal.GraphQLHttpHandler.ReadHttpResponseMessageAsync(HttpResponseMessage httpResponseMessage)
   at GraphQL.Client.Http.Internal.GraphQLHttpHandler.PostAsync(GraphQLRequest request, CancellationToken cancellationToken)
   at Sitecore.DevEx.Core.Client.GraphQl.SitecoreApiClient.<>c__DisplayClass11_0.<<RunQuery>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at Sitecore.DevEx.Configuration.Authentication.OidcAuthenticationProvider.MakeAuthenticatedRequestInternal(HttpClient client, Func`2 requestAction) in C:\BA\ca7111d945a16af4\src\Sitecore.DevEx.Configuration\Authentication\OidcAuthenticationProvider.cs:line 86
   at Sitecore.DevEx.Configuration.Authentication.OidcAuthenticationProvider.MakeAuthenticatedRequest(HttpClient client, Func`2 requestAction) in C:\BA\ca7111d945a16af4\src\Sitecore.DevEx.Configuration\Authentication\OidcAuthenticationProvider.cs:line 30
   at Sitecore.DevEx.Configuration.Models.EnvironmentConfiguration.MakeAuthenticatedRequest(HttpClient client, Func`2 requestAction) in C:\BA\ca7111d945a16af4\src\Sitecore.DevEx.Configuration\Models\EnvironmentConfiguration.cs:line 313
   at Sitecore.DevEx.Core.Client.GraphQl.SitecoreApiClient.RunQuery(String servicePath, GraphQLRequest request, Boolean assertNoErrors, CancellationToken cancellationToken)
   at Sitecore.DevEx.Serialization.Client.Datasources.Sc.Query.SitecoreTreeDataStore.ExecuteSingleBatchQuery[T](String batchQueryFragment, TreeScope scope, ItemSpec[] specs, CancellationToken cancellationToken)
   at Sitecore.DevEx.Serialization.Client.Datasources.Sc.Query.SitecoreTreeDataStore.<>c__DisplayClass21_0`1.<<CreateParallelQuery>b__0>d.MoveNext()
1
  • The error is saying your server is responding with Internal Server Error - have you looked at the logs on the CM?
    – Richard Seal
    Commented Aug 7, 2023 at 19:28

1 Answer 1

1

Sitecore support resolved the issue. Here is their response:

"Thank you for confirmation. Serialization pull command used management service api on CM, which seems to fail with following error:

4108 01:48:10 INFO  /sitecore/api/management
4108 01:48:12 ERROR Application error.
Exception: System.NullReferenceException
Message: Object reference not set to an instance of an object.
Source: Sitecore.ContentTesting
   at Sitecore.ContentTesting.Pipelines.EvaluateTestExposureBase`1.Process(TPipelineArgs args)
   at (Object , Object )
   at Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args)
   at Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain, Boolean failIfNotExists)
   at Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain)
   at Sitecore.Mvc.Pipelines.PipelineService.RunPipeline[TArgs](String pipelineName, TArgs args)
   at Sitecore.Mvc.Routing.RouteHttpHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData)
   at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step)
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

Based on review of concerned processor we found that it can fail when device is null. That happens when site is not identified.

Overall, the exception is thrown because the EvaluateTestExposureBase.Process(...) method doesn't check if the device is null before accessing it's properties. This behavior has been registered as a bug in our bug tracking system. Thank you for reporting the problem.

To track the future status of this bug report, please use reference number 509821. More information about public reference numbers can be found here: https://support.sitecore.com/kb?id=kb_article_view&sysparm_article=KB0853187"

The problem was caused by the setup in my machine where I had different Sitecore instances for my CM and CD. The serialization pull command used would try to locate the CD site's binding on the CM site and would fail on not being found.

Support said "to address this issue, please do one of the following

  • Update configs to associate psegsc.dev.local to the concerned site.
  • Add IIS binding for one of the hostname in cofigs and use that for pull request."

I took the second option.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.