Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

Service Api (4.2.1) - Unable to access catalog



I am trying to access the entries and nodes of our catalog but get the error below. The endpoints not related to the catalog work just fine.

Any advice ?


"Message": "An error has occurred.",
"ExceptionMessage": "Object reference not set to an instance of an object.",
"ExceptionType": "System.NullReferenceException",
"StackTrace": " at EPiServer.UriSupport.AbsoluteUrlBySettings(String path)
\n at EPiServer.ServiceApi.Commerce.Controllers.Catalog.Construction.MetaDataModelFactory.GetVirtualPath(String assetKey, Boolean thumbnaill)
\n at EPiServer.ServiceApi.Commerce.Controllers.Catalog.Construction.MetaDataModelFactory.d__6.MoveNext()
\n at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)\n at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
\n at EPiServer.ServiceApi.Commerce.Controllers.Catalog.Construction.EntryModelFactory.InitializeCollections(Entry model, Entry entry, String language, MetaClass metaClass, CatalogDto catalog)
\n at EPiServer.ServiceApi.Commerce.Controllers.Catalog.Construction.EntryModelFactory.CreateEntryModel(Entry entry, String language)
\n at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()
\n at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
\n at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
\n at EPiServer.ServiceApi.Commerce.Controllers.Catalog.Construction.EntryModelFactory.CreateEntriesModel(String languageCode, Int32 startPage, Int32 pageSize)
\n at EPiServer.ServiceApi.Commerce.Controllers.Catalog.EntryController.GetCatalogEntries(Int32 startPage, Int32 pageSize)
\n at lambda_method(Closure , Object , Object[] )
\n at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass10.b__9(Object instance, Object[] methodParameters)
\n at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary`2 arguments, CancellationToken cancellationToken)
\n--- End of stack trace from previous location where exception was thrown ---

Edited, Sep 20, 2018 17:36

It sounds like you need to add wildcard host name to your site definition 

Sep 20, 2018 18:32

Thanks, but can you be a bit more specific ?

Sep 20, 2018 18:34

Basically this

Edited, Sep 20, 2018 21:09

I guess it is a screenshot but the link is broken.

Sep 20, 2018 21:16

Hmm, it worked for me. Please try again now 

Sep 20, 2018 22:19

Quan, I don't see a screenshot or a link either.

Sep 20, 2018 23:18

Dạmn.. It seems the file is ok for a while then it was deleted. Will check with World team tomorrow. On phone, can't really do anything now

Sep 20, 2018 23:42

@David: Sorry for the confusion, here's how to add the wildcard hostname 

Sep 21, 2018 6:58

Thanks, it worked!

I already had the wildcard set for my web site. The only difference was that the culture was set on the wilcard but not on the hostname. I added the culture on both, then it worked.

Sep 21, 2018 16:04
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.