0

We've setup Sitecore 10.1 in containers. A CORS error always occurs when loading the Experience Profile. The error happens on POST to /sitecore/api/ao/v1/contacts/search and also when saving a Sitecore Form, on a POST to /sitecore/api/ao/v1/contacts/search.

There are plenty of other POSTS throughout CM which work correctly. I do not see any error in the Sitecore log. The response body of the POST which fails contains below error. FYI I did not enable CORS as described in this answer and am not able to reproduce this issue with the same code on a local VM.

Does anyone know how to fix this?

Value cannot be null or an empty string.\r\nParameter name: origins","ExceptionType":"System.ArgumentException","StackTrace":"   
at System.Web.Http.Cors.EnableCorsAttribute..ctor(String origins, String headers, String methods, String exposedHeaders)\r\n   
at Sitecore.Services.Infrastructure.Cors.CorsPolicyProviderFactory.GetProviderFromOrigins(HttpRequestMessage request)\r\n   
at System.Web.Http.Cors.CorsMessageHandler.<GetCorsPolicyAsync>d__6.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   
at System.Web.Http.Cors.CorsMessageHandler.<HandleCorsRequestAsync>d__3.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Cors.CorsMessageHandler

1 Answer 1

0

Posting answer in case anyone else runs into this. I do not have Horizon setup, but my CM Dockerfile still copied some of its artifacts which caused this issue. Removing below lines from Dockerfile fixed it:

# Add horizon module
COPY --from=horizon_resources \module\cm\content \inetpub\wwwroot

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.