Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more

502 error when querying block data in prod

Vote:
 

This is the underlying error:

EPiServer.Framework.Cache.ObjectInstanceCacheExtensions : Failed to Read cacheKey = 'EPPageData:320537:en-us'
System.NullReferenceException: Object reference not set to an instance of an object.
   at EPiServer.Core.Internal.DefaultContentProvider.GetLanguageId(ILanguageSelector selector)
   at EPiServer.Core.Internal.DefaultContentProvider.LoadContent(ContentReference contentLink, ILanguageSelector languageSelector)
   at EPiServer.Core.ContentProvider.<>c__DisplayClass127_0.<LoadContentFromCacheOrRepository>b__0()
   at EPiServer.Framework.Cache.ObjectInstanceCacheExtensions.ReadThroughWithWait[T](IObjectInstanceCache cache, String cacheKey, Func`1 readValue, Func`2 evictionPolicy)
---------
EPiServer.ContentApi.Cms.Controllers.ContentApiController : Error occurred during Content Api Get Request
System.NullReferenceException: Object reference not set to an instance of an object.
   at EPiServer.Core.Internal.DefaultContentProvider.GetLanguageId(ILanguageSelector selector)
   at EPiServer.Core.Internal.DefaultContentProvider.LoadContent(ContentReference contentLink, ILanguageSelector languageSelector)
   at EPiServer.Core.ContentProvider.<>c__DisplayClass127_0.<LoadContentFromCacheOrRepository>b__0()
   at EPiServer.Framework.Cache.ObjectInstanceCacheExtensions.ReadThroughWithWait[T](IObjectInstanceCache cache, String cacheKey, Func`1 readValue, Func`2 evictionPolicy)
   at EPiServer.Core.Internal.ContentInstanceCache.ReadThrough(ContentReference contentLink, String selectedLanguage, Func`1 readValue)
   at EPiServer.Core.ContentProvider.LoadContentFromCacheOrRepository(ContentReference contentreference, ILanguageSelector selector)
   at EPiServer.Core.Internal.ProviderPipelineImplementation.GetItem(ContentProvider provider, ContentReference contentLink, LoaderOptions loaderOptions)
   at EPiServer.Core.Internal.DefaultContentLoader.TryGet[T](ContentReference contentLink, LoaderOptions loaderOptions, T& content)
   at EPiServer.Core.Internal.DefaultContentLoader.Get[T](ContentReference contentLink, LoaderOptions loaderOptions)
   at EPiServer.ContentApi.Core.ContentLoaderService.Get(ContentReference contentReference, String language, Boolean fallbackToMaster)
   at EPiServer.ContentApi.Cms.Controllers.ContentApiController.Get(String contentReference, List`1 languages, String expand, String select)

This error only occurs in prod. I can pull the content of the page using: https://<url>/api/episerver/v2.0/content/<id>?expand=*. The content returns for the page, but when I use the block ID to pull that data, it gives me a 502. Any ideas on what's going wrong here?

#288173
Sep 27, 2022 14:50
Vote:
 

Following up, the error only seems to occur when I place blocks in folders. I tried a few different folders and they all fail. But if I place the block in the “for this page” folder, it works fine. Is there some sort of security or setup that needs to be changed here?

#288179
Edited, Sep 27, 2022 17:23
Vote:
 

Are you sending the correct header.  Is your content in en or en-us?

Accept-Language 
#288180
Sep 27, 2022 17:42
eperezjr - Sep 27, 2022 17:44
I'm not sending anything there. It only errors when the blocks are in a folder. If it's in the "for this page" folder, it works fine. and works fine in int and staging
* 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.