November Happy Hour will be moved to Thursday December 5th.

Service Api (4.2.1) - Unable to access catalog

Vote:
 

Hi,

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 ?

David

"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 ---

#197065
Edited, Sep 20, 2018 17:36
Vote:
 

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

#197069
Sep 20, 2018 18:32
Vote:
 

Thanks, but can you be a bit more specific ?

#197070
Sep 20, 2018 18:34
Vote:
 

Basically this

#197074
Edited, Sep 20, 2018 21:09
Vote:
 

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

#197075
Sep 20, 2018 21:16
Vote:
 

Hmm, it worked for me. Please try again now 

#197078
Sep 20, 2018 22:19
Vote:
 

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

#197079
Sep 20, 2018 23:18
Vote:
 

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

#197080
Sep 20, 2018 23:42
Vote:
 

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

#197086
Sep 21, 2018 6:58
Vote:
 

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.

#197103
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.