After upgrade to .net6, tried to include Episerver.Find.Cms(14.2.4) to application then the front end website breaks.

Vote:
 

We have recenlty upgraded the solution from .net 5 to .net 6 using the Episerver.CMS 12.5.1 version and the website works as expected. Now we are including the Episerver.Find.CMS(14.2.4), and also we haven't made any customization around Find dll.  After this, we are able to access the url: Episver/Find/ and i can do the indexing of the pages as well, navigate through pages on the conosle level.

But the issue is on the front end side,  when i tried to access any page from webssite it works for the first time and the site breaks either if i naviagte to other pages or refresh the current page. Here is the error 

I have tried with 15.0.0 of EPiserver.Find.CMS to see if helps to resolve the issue but no luck there.

Happy to know if you have any guess around this isuse.

#296884
Feb 20, 2023 19:51
Vote:
 

Have you a custom ClientResourceExtensions.RequiredClientResources (Or something else) that might already be adding a defer attribute to scripts ? 

#296886
Edited, Feb 20, 2023 22:02
Vote:
 

Would it be possible to run this code somewhere:

            string TrackingScriptName = "epi.find.trackingScript";

            var clientResourceService = ServiceLocator.Current.GetInstance<IClientResourceService>();

            var trackingScripts = clientResourceService.GetClientResources(TrackingScriptName, new[] { ClientResourceType.Script }).ToList();

what can you see in trackingScripts  ? It seems like you have duplicated resource registration in your module.config.

#296941
Feb 21, 2023 7:47
Vote:
 

We don't have any custom for this ClientResourceExtensions.RequiredClientResources.

#296951
Feb 21, 2023 17:36
Vote:
 

Quan, 

I tried to run the code and what i see in trackingScripts is zero for the first time but when i refresh the page again i notice there is one script for "epi.find.trackingScript" which has a defer attribute already which is breaking the page.

#296952
Feb 21, 2023 17:41
Vote:
 

In startup file, registering the services.AddSingleton<IClientResourceService, ClientResourceService>();. After removing this service regsiter the site is now working as expected. 

Before adding the find to the application, the site intially working with service(IClientResourceServic) register. Any thoughts around this? 

#297070
Feb 23, 2023 15:21
Vote:
 

Do you have AddCmsFrameworkWeb() ? it would call that registration already

I think it register ClientResourceService as Transient, which is why when you regsiter as AddSingleton things will be called twice. 

#297130
Feb 24, 2023 10:03
Vote:
 

For us, this was/is an issue with Custom Error hanldling, i.e. when a page is loaded the EPiServer.Find.UI.ScriptInjection class is called, adding the script to the required client resources. Then when a 500 error is encountered, the custom error page is served instead. During the rendering of the custom error page, the EPiServer.Find.UI.ScriptInjection is called a second time and tries to add the 'defer' attribute again to the dictiorary. This leads to the exception, ‘ArgumentException: An item with the same key has already been added. Key: defer’

This has been accepted as a bug... but I'm still waiting for the fix

https://world.optimizely.com/support/Bug-list/bug/FIND-12783

#325576
Jul 18, 2024 5:33
Vote:
 

For us, this was/is an issue with Custom Error hanldling, i.e. when a page is loaded the EPiServer.Find.UI.ScriptInjection class is called, adding the script to the required client resources. Then when a 500 error is encountered, the custom error page is served instead. During the rendering of the custom error page, the EPiServer.Find.UI.ScriptInjection is called a second time and tries to add the 'defer' attribute again to the dictiorary. This leads to the exception, ‘ArgumentException: An item with the same key has already been added. Key: defer’

This has been accepted as a bug... but I'm still waiting for the fix

https://world.optimizely.com/support/Bug-list/bug/FIND-12783

#325577
Jul 18, 2024 5:33
* 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.