U4-1443 - Exception when creating a document using an Umbraco Scheduled task

Created by Richard Soeteman 12 Jan 2013, 07:08:00 Updated by Sebastiaan Janssen 14 Jan 2013, 18:15:01

When I create a document using a handler that is called via a scheduled task (CMSImport) I get the following exception.

System.ArgumentException occurred HResult=-2147024809 Message=The Cookie containing the UserContext Guid Id was null Parameter name: Cookie Source=Umbraco.Core ParamName=Cookie StackTrace: at Umbraco.Core.Services.UserService.GetCurrentBackOfficeUser(HttpContextBase httpContext) at Umbraco.Core.Services.ContentService.SetWriter(IContent content, Int32 userId) at Umbraco.Core.Services.ContentService.Save(IContent content, Int32 userId) at umbraco.cms.businesslogic.web.Document.MakeNew(String Name, DocumentType dct, User u, Int32 ParentId) at CMSImportLibrary.Import.ContentImporter.Import(ImportState state, User importAsUser, ImportStatistics importStatistics, String parentDataRelationKey, Int32 parent, String datasourceFile) InnerException:

Comments

Morten Christensen 12 Jan 2013, 13:36:35

This is a funny one, as it looks like there is an HttpContext but it cannot retrieve the umbraco auth cookie (probably because there is no current user), but a bit odd it reaches this point. What User/UserId are you passing to the Document.MakeNew method?


Richard Soeteman 13 Jan 2013, 08:55:47

In this case the Admin user (0) but it can be any available user.


Priority: Normal

Type: Bug

State: Fixed

Assignee: Morten Christensen

Difficulty: Normal

Category:

Backwards Compatible: True

Fix Submitted:

Affected versions: 6.0.0

Due in version: 6.0.0

Sprint:

Story Points:

Cycle: