Skip to content

Import fails on uSync import. #718

Description

@KevinJump

[Reported via Jumoo Website]

I am getting an exception every time I start Umbraco. The stack trace shows that usync tries to publish an item calling Umbraco code. This ends up in an error because httpContext is null. I have recreated it in a clean umbraco. I have recreated with * Umbraco 15.0.0 and uSync 15.0.0 * Umbraco 15.2.1 and uSync 15.1.2 Same error.

My usync config looks like this.

Notice "ImportAtStartup": "Settings,Content"

{
   "uSync":{
      "Settings":{
         "RootFolder":"uSync/v15/",
         "DefaultSet":"Default",
         "ImportAtStartup":"Settings,Content",
         "ExportAtStartup":"None",
         "ExportOnSave":"Settings",
         "UiEnabledGroups":"All",
         "ReportDebug":false,
         "AddOnPing":true,
         "FailOnMissingParent":false,
         "CacheFolderKeys":true,
         "ShowVersionCheckWarning":true,
         "CustomMappings":{
            
         },
         "EnableHistory":true,
         "BackgroundNotifications":false
      },
      "Sets":{
         "Default":{
            "Enabled":true,
            "HandlerGroups":[
               
            ],
            "DisabledHandlers":[
               "DomainHandler",
               "MediaHandler",
               "RelationTypeHandler"
            ],
            "HandlerDefaults":{
               "Enabled":true,
               "Actions":[
                  
               ],
               "UseFlatStructure":true,
               "GuidNames":false,
               "FailOnMissingParent":false,
               "Group":"",
               "Settings":{
                  
               }
            },
            "Handlers":{
               
            }
         }
      }
   }
}

From the log:

[10:50:17 INF] Application started. Press Ctrl+C to shut down. 
[10:50:17 INF] Hosting environment: Development
[10:50:17 INF] Content root path: C:\p\dr\UmbracoInstalls\umbraco-20250218103738-15.2.0 
[10:50:17 INF] uSync: Running Import at startup Settings,Content 
[10:50:19 INF] Adding examine event handlers for 3 index providers. 
[10:50:19 WRN] Notifications can not be sent, no site URL is set (might be during boot process?) 
[10:50:19 WRN] Notifications can not be sent, no site URL is set (might be during boot process?) 
[10:50:22 INF] Document ************* (id=1129) has been published. 
[10:50:23 WRN] Notifications can not be sent, no site URL is set (might be during boot process?) 
[10:50:23 WRN] [ContentHandler] ImportElement Failed : 
System.AggregateException: One or more errors occurred. (One or more errors occurred. (HttpContext is null)) 
---> System.AggregateException: One or more errors occurred. (HttpContext is null) 
---> System.InvalidOperationException: HttpContext is null 
 at Umbraco.Extensions.HttpContextAccessorExtensions.GetRequiredHttpContext(IHttpContextAccessor httpContextAccessor) 
 at Umbraco.Cms.Web.Common.AspNetCore.AspNetCoreRequestAccessor.GetFormValue(String name) 
 at Umbraco.Cms.Web.Common.AspNetCore.AspNetCoreRequestAccessor.GetRequestValue(String name) 
 at Umbraco.Cms.Core.Routing.ContentFinderByPageIdQuery.TryFindContent(IPublishedRequestBuilder frequest) 
 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, IPublishedContentCache contentCache, IDocumentNavigationQueryService navigationQueryService) 
 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, IPublishedContentCache contentCache, IDocumentNavigationQueryService navigationQueryService) 
 at Umbraco.Extensions.UrlProviderExtensions.GetContentUrlsAsync(IContent content, IPublishedRouter publishedRouter, IUmbracoContext umbracoContext, ILanguageService languageService, ILocalizedTextService textService, IContentService contentService, IVariationContextAccessor variationContextAccessor, ILogger`1 logger, UriUtility uriUtility, IPublishedUrlProvider publishedUrlProvider, IPublishedContentCache contentCache, IDocumentNavigationQueryService navigationQueryService) 
 at Umbraco.Cms.Core.Events.AddUnroutableContentWarningsWhenPublishingNotificationHandler.HandleAsync(ContentPublishedNotification notification, CancellationToken cancellationToken) 
 at Umbraco.Cms.Core.Events.INotificationAsyncHandler`1.HandleAsync(IEnumerable`1 notifications, CancellationToken cancellationToken) 
 at Umbraco.Cms.Core.Events.EventAggregator.PublishCoreAsync[TNotification](IEnumerable`1 allHandlers, IEnumerable`1 notifications, CancellationToken cancellationToken) 
 at Umbraco.Cms.Core.Events.NotificationAsyncHandlerWrapperImpl`1.HandleAsync[TNotification,TNotificationHandler](IEnumerable`1 notifications, CancellationToken cancellationToken, ServiceFactory serviceFactory, Func`4 publish) 
 at Umbraco.Cms.Core.Events.EventAggregator.PublishNotificationsAsync[TNotification,TNotificationHandler](IEnumerable`1 notifications, CancellationToken cancellationToken) --- End of inner exception stack trace --- 
 at System.Threading.Tasks.Task.WaitAllCore(ReadOnlySpan`1 tasks, Int32 millisecondsTimeout, CancellationToken cancellationToken) 
 at System.Threading.Tasks.Task.WaitAll(ReadOnlySpan`1 tasks) 
 at Umbraco.Cms.Core.Events.EventAggregator.Publish[TNotification,TNotificationHandler](IEnumerable`1 notifications) 
 at Umbraco.Cms.Core.Events.ScopedNotificationPublisher`1.PublishScopedNotifications(IList`1 notifications) 
 at Umbraco.Cms.Core.Events.ScopedNotificationPublisher`1.ScopeExit(Boolean completed) 
 at Umbraco.Cms.Core.Scoping.CoreScope.HandleScopedNotifications() 
 at Umbraco.Cms.Infrastructure.Scoping.Scope.TryFinally(Action[] actions) --- End of inner exception stack trace --- 
 at Umbraco.Cms.Infrastructure.Scoping.Scope.TryFinally(Action[] actions) 
 at Umbraco.Cms.Infrastructure.Scoping.Scope.RobustExit(Boolean completed, Boolean onException) 
 at Umbraco.Cms.Infrastructure.Scoping.Scope.DisposeLastScope() 
 at Umbraco.Cms.Infrastructure.Scoping.Scope.Dispose() 
 at Umbraco.Cms.Core.Services.ContentService.Publish(IContent content, String[] cultures, Int32 userId) 
 at Umbraco.Cms.Core.Services.ContentService.Publish(IContent content, String[] cultures, Int32 userId) 
 at USync.Core.Serialization.Serializers.ContentSerializer.PublishItem(IContent item, Int32 userId) 
 at USync.Core.Serialization.Serializers.ContentSerializer.DoSaveOrPublish(IContent item, XElement node, SyncSerializerOptions options) 
 at USync.Core.Serialization.Serializers.ContentSerializer.DeserializeCoreAsync(XElement node, SyncSerializerOptions options) 
 at USync.Core.Serialization.SyncSerializerRoot`1.DeserializeAsync(XElement node, SyncSerializerOptions options) 
 at USync.BackOffice.SyncHandlers.SyncHandlerRoot`2.DeserializeItemAsync(XElement node, SyncSerializerOptions options) 
 at USync.BackOffice.SyncHandlers.SyncHandlerRoot`2.ImportElementAsync(XElement node, String filename, HandlerSettings settings, uSyncImportOptions options) 


[10:50:23 INF] uSync Import: 10 handlers, processed 122 items, 3 changes in 5520ms 
[10:50:23 INF] uSync: Startup Complete 5700ms 

Does this look like a uSync issue or an Umbraco issue? Or could I have done something wrong?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    15.x NETCOREv15 things.InvestigatingLooking at this issue to see if we can identify a root cause

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions