1

We have two CM servers with their own Publishing Service and load balancer.

When I publish an item directly on server machine it works fine. But when I access website externally (request comes through balancer) then I catch null-reference error.

POST requests from browser are identically. In log files I see that model that comes to CM controller action after load balancer is null:

    [HttpPost]
    [DenyNonPublishingRoles]
    public HttpResponseMessage ItemPublish([FromBody] PublishingJobEntity entity)
    {
      Condition.Requires<PublishingJobEntity>(entity, nameof (entity)).IsNotNull<PublishingJobEntity>();
      Condition.Requires<string>(entity.ItemId, "itemId").IsNotNull<string>();
      HttpResponseMessage entity1 = this.CreateEntity(entity);
      entity1.Content = (HttpContent) new ObjectContent<PublishingJobEntity>(entity, (MediaTypeFormatter) new JsonMediaTypeFormatter(), "application/json");
      return entity1;
    }

ErrorMessage: entity should not be null. ↵Parameter name: entity.

UPDATE

Even if I try to republish old job I get:

enter image description here

In console it is a simple POST request to https://mywebsite.com/sitecore/api/ssc/publishing/jobs/0/Republish with single jobId parameter.

I can easy reproduce the same with POSTMAN. And again, when I do it on server - all is fine, when remotely - catch an error:

11320 17:15:37 ERROR [Sitecore Services]: HTTP POST
URL https://mywebsite.com/sitecore/api/ssc/publishing/jobs/0/Republish

Exception System.AggregateException: One or more errors occurred. ---> Refit.ApiException: Response status code does not indicate success: 400 (Bad Request).
   at Refit.RequestBuilderImplementation`1.<>c__DisplayClass13_0`1.<<BuildCancellableTaskFuncForMethod>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Sitecore.Publishing.Service.RemoteProxies.PublishJobQueueServiceRemoteProxy.<GetJob>d__3.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Sitecore.Publishing.Service.Data.PublishingJobProvider.<Get>d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Sitecore.Publishing.Service.Client.Services.Data.PublishingJobRepository.<>c__DisplayClass16_0.<<FindById>b__0>d.MoveNext()
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
   at Sitecore.Publishing.Service.Client.Services.Data.PublishingJobRepository.FindById(String id)
   at Sitecore.Publishing.Service.Client.Services.Controllers.PublishingJobController.Republish(Guid jobId)
   at lambda_method(Closure , Object , Object[] )
   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass6_1.<GetExecutor>b__3(Object instance, Object[] methodParameters)
   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary`2 arguments, CancellationToken cancellationToken)
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Controllers.ApiControllerActionInvoker.<InvokeActionAsyncCore>d__1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Filters.ActionFilterAttribute.<ExecuteActionFilterAsyncCore>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Filters.AuthorizationFilterAttribute.<ExecuteAuthorizationFilterAsyncCore>d__3.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Filters.AuthorizationFilterAttribute.<ExecuteAuthorizationFilterAsyncCore>d__3.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Filters.AuthorizationFilterAttribute.<ExecuteAuthorizationFilterAsyncCore>d__3.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Dispatcher.HttpControllerDispatcher.<SendAsync>d__15.MoveNext()
---> (Inner Exception #0) Refit.ApiException: Response status code does not indicate success: 400 (Bad Request).
   at Refit.RequestBuilderImplementation`1.<>c__DisplayClass13_0`1.<<BuildCancellableTaskFuncForMethod>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Sitecore.Publishing.Service.RemoteProxies.PublishJobQueueServiceRemoteProxy.<GetJob>d__3.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Sitecore.Publishing.Service.Data.PublishingJobProvider.<Get>d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Sitecore.Publishing.Service.Client.Services.Data.PublishingJobRepository.<>c__DisplayClass16_0.<<FindById>b__0>d.MoveNext()<---

Has anybody faced similar issue?

  • 2
    Is you load balancer sticky? If it is not sticky, it may happen that one request is to CM1, second request is to CM2. But one of CM doesn't have context and that is why is throwing error. – Anton May 14 at 16:18
  • Thank you, @Anton! It seems you are right, I will check it. – x3mxray May 15 at 8:35
  • No, it is not a solution. Sticky session was enabled. I have no idea, is it a problem of Publishing Module or of load balancer. – x3mxray May 15 at 13:59
0

An issue was caused by WAF (Web Application Firewall) on load balanced server.

Still did not find what exactly is the reason on WAF side, but disabling of WAF solved the problem.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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