ZioTino / Our.Umbraco.Skipper

An Umbraco package that lets you specify nodes and document types that will be excluded from Umbraco's URL generation.
https://ziotino.github.io/Our.Umbraco.Skipper/
MIT License
4 stars 3 forks source link

Errors on single culture site with more than one language configured #3

Closed torerikk closed 1 year ago

torerikk commented 2 years ago

I'm seeing a lot of "GetUrl exception" messages in the log on a site that isn't using the "vary by culture"-system, but has more than one language configured.

It looks to me like Skipper is trying to create an URL for all the languages, not just the one used on the page. This probably relates to this issue: https://github.com/umbraco/Umbraco-CMS/issues/11234

ZioTino commented 2 years ago

Hi @torerikk Can you please share your logs? Thank you!

torerikk commented 2 years ago

Hi

Just by opening a page that is a child of a "skipped" page I get this error:

Jun 27, 2022 1:17:57 PM | Error | FW-IDEAPAD3 | GetUrl exception.

System.ArgumentNullException: Value cannot be null. (Parameter 'Base GetUrl for Id 1148.')
at Our.Umbraco.Skipper.SkipperUrlProvider.BuildUrl(IPublishedContent content, Uri current, UrlMode mode, String culture)    at Our.Umbraco.Skipper.SkipperUrlProvider.GetUrl(IPublishedContent content, UrlMode mode, String culture, Uri current)
at Umbraco.Cms.Core.Routing.UrlProvider.<>c__DisplayClass14_0.<GetUrl>b__1(IUrlProvider provider)
at System.Linq.Enumerable.SelectEnumerableIterator`2.MoveNext()
at System.Linq.Enumerable.TryGetFirst[TSource](IEnumerable`1 source, Func`2 predicate, Boolean& found)
at Umbraco.Cms.Core.Routing.UrlProvider.GetUrl(IPublishedContent content, UrlMode mode, String culture, Uri current)
at Umbraco.Extensions.UrlProviderExtensions.GetContentUrlsByCultureAsync(IContent content, IEnumerable`1 cultures, IPublishedRouter publishedRouter, IUmbracoContext umbracoContext, IContentService contentService, ILocalizedTextService textService, IVariationContextAccessor variationContextAccessor, ILogger logger, UriUtility uriUtility, IPublishedUrlProvider publishedUrlProvider)

I don't have a lot of time today, if you need a more detailed debug log I can share that later this week.

philipdanielhayton commented 2 years ago

This is also happening to me, to add some more context - it seems to happen whenever you have a published node of a doc type that doesnt have 'Allow vary by culture' set to true. The error will occur when the page is published (not saved), and any time you navigate to the node.

In my case it happens whenever I forget to set a new doc type to allow vary by culture (which is quite often). It's not a big deal for me to fix this, but there may be some cases where you don't need or want to allow content to vary by culture.

Here is my stack trace:

at Our.Umbraco.Skipper.SkipperUrlProvider.BuildUrl(IPublishedContent content, Uri current, UrlMode mode, String culture)
   at Our.Umbraco.Skipper.SkipperUrlProvider.GetUrl(IPublishedContent content, UrlMode mode, String culture, Uri current)
   at Umbraco.Cms.Core.Routing.UrlProvider.<>c__DisplayClass14_0.<GetUrl>b__1(IUrlProvider provider)
   at System.Linq.Enumerable.SelectEnumerableIterator`2.MoveNext()
   at System.Linq.Enumerable.TryGetFirst[TSource](IEnumerable`1 source, Func`2 predicate, Boolean& found)
   at Umbraco.Cms.Core.Routing.UrlProvider.GetUrl(IPublishedContent content, UrlMode mode, String culture, Uri current)
   at Umbraco.Extensions.PublishedContentExtensions.Url(IPublishedContent content, IPublishedUrlProvider publishedUrlProvider, String culture, UrlMode mode)
   at Our.Umbraco.Skipper.SkipperContentFinder.<>c__DisplayClass4_0.<TryFindContent>b__0(IPublishedContent x)
   at System.Linq.Enumerable.TryGetFirst[TSource](IEnumerable`1 source, Func`2 predicate, Boolean& found)
   at Our.Umbraco.Skipper.SkipperContentFinder.TryFindContent(IPublishedRequestBuilder request)
   at Umbraco.Cms.Core.Routing.PublishedRouter.<>c__DisplayClass24_0.<FindPublishedContent>b__0(IContentFinder finder)
   at System.Linq.Enumerable.Any[TSource](IEnumerable`1 source, Func`2 predicate)
   at Umbraco.Cms.Core.Routing.PublishedRouter.FindPublishedContent(IPublishedRequestBuilder request)
   at Umbraco.Cms.Core.Routing.PublishedRouter.TryRouteRequest(IPublishedRequestBuilder request)
   at Umbraco.Cms.Core.Routing.PublishedRouter.RouteRequestAsync(IPublishedRequestBuilder builder, RouteRequestOptions options)
   at Umbraco.Extensions.UrlProviderExtensions.DetectCollisionAsync(ILogger logger, IContent content, String url, String culture, IUmbracoContext umbracoContext, IPublishedRouter publishedRouter, ILocalizedTextService textService, IVariationContextAccessor variationContextAccessor, UriUtility uriUtility)
   at Umbraco.Extensions.UrlProviderExtensions.GetContentUrlsByCultureAsync(IContent content, IEnumerable`1 cultures, IPublishedRouter publishedRouter, IUmbracoContext umbracoContext, IContentService contentService, ILocalizedTextService textService, IVariationContextAccessor variationContextAccessor, ILogger logger, UriUtility uriUtility, IPublishedUrlProvider publishedUrlProvider)
   at Umbraco.Extensions.UrlProviderExtensions.GetContentUrlsAsync(IContent content, IPublishedRouter publishedRouter, IUmbracoContext umbracoContext, ILocalizationService localizationService, ILocalizedTextService textService, IContentService contentService, IVariationContextAccessor variationContextAccessor, ILogger`1 logger, UriUtility uriUtility, IPublishedUrlProvider publishedUrlProvider)
   at Umbraco.Cms.Web.BackOffice.Mapping.ContentMapDefinition.GetUrls(IContent source)
   at Umbraco.Cms.Web.BackOffice.Mapping.ContentMapDefinition.Map(IContent source, ContentItemDisplay target, MapperContext context)
   at Umbraco.Cms.Core.Mapping.UmbracoMapper.Map[TTarget](Object source, Type sourceType, MapperContext context)
   at Umbraco.Cms.Core.Mapping.UmbracoMapper.Map[TTarget](Object source, MapperContext context)
   at Umbraco.Cms.Web.BackOffice.Controllers.ContentController.MapToDisplay(IContent content, Action`1 contextOptions)
   at Umbraco.Cms.Web.BackOffice.Controllers.ContentController.GetById(Int32 id)
   at lambda_method1090(Closure , Object , Object[] )
   at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.SyncObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeActionMethodAsync()
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeNextActionFilterAsync()
--- End of stack trace from previous location ---
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()
--- End of stack trace from previous location ---
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextExceptionFilterAsync>g__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
archimedecreativa commented 1 year ago

Hi @torerikk Can you update and retry? Thank you!

torerikk commented 1 year ago

Looks like the problem is fixed now :) Thanks!