[Solved] Umbraco Forms missing Examine index file, how to fix?
t

TackleMcClean ๐Ÿ…

9 months ago
I am trying to go into Settings > Examine in the backoffice, but there's something wrong with my Umbraco Forms Examine Index. Is there any way to resurrect this situation without resetting to a new installation? It would make me lose so many hours of work to not be able to continue with this setup. This is for local development. This is Umbraco CMS 13.4.1 and Umbraco Forms 13.2.1 The error I get is, also see the image:
System.IO.FileNotFoundException: Could not find file 'C:\Users\username\AppData\Local\Temp\ExamineIndexes\8fa855ceccf189764127bc5ada4f7b3c\UmbracoFormsRecordsIndex\_3x.fdx'.
File name: 'C:\Users\username\AppData\Local\Temp\ExamineIndexes\8fa855ceccf189764127bc5ada4f7b3c\UmbracoFormsRecordsIndex\_3x.fdx'
   at System.IO.FileInfo.get_Length()
   at Lucene.Net.Store.FSDirectory.FileLength(String name)
   at Lucene.Net.Replicator.IndexRevision.CreateRevisionFile(String fileName, Directory directory)
   at Lucene.Net.Replicator.IndexRevision.RevisionFiles(IndexCommit commit)
   at Lucene.Net.Replicator.IndexReplicationHandler..ctor(Directory indexDirectory, Action callback)
   at Examine.Lucene.ExamineReplicator..ctor(ILoggerFactory loggerFactory, LuceneIndex sourceIndex, Directory destinationDirectory, DirectoryInfo tempStorage)
   at Examine.Lucene.Directories.SyncedFileSystemDirectoryFactory.CreateDirectory(LuceneIndex luceneIndex, Boolean forceUnlock)
   at Examine.Lucene.Directories.DirectoryFactoryBase.<>c__DisplayClass2_0.
... // more log cutoff due to Discord
https://cdn.discordapp.com/attachments/1276462817029001236/1276462817184059454/image.png?ex=66c99e23&is=66c84ca3&hm=e55abd9bcfe4607d73a11d25ac43ab1b65048536b4c59afd0834122f1cbcd5c7&
[Solved] Api controller backoffice user is null when firing requests though swagger.
j

Jack

10 months ago
Hello this is my first post. I am trying v14 of Umbraco, and have been following the tutorial on how to add a custom swagger document. Article: https://docs.umbraco.com/umbraco-cms/tutorials/creating-a-backoffice-api/adding-a-custom-swagger-document I created my first simple api controller "logout" and so far so good it shows up on the swagger dashboard. I authorize myself and try requesting from swagger, at first i get a 401, which i don't understand, as i am logged in as an admin.
csharp
namespace Test.Web.Controllers.Api
{
    [ApiController]
    [ApiVersion("1.0")]
    [MapToApi("test-v1")]
    [Authorize(Policy = AuthorizationPolicies.BackOfficeAccess)]
    [JsonOptionsName(Constants.JsonOptionsNames.BackOffice)]
    [Route("api/v{version:apiVersion}/test")]
    public class LogoutController : Controller
    {
        private readonly INotificationService _notificationService;
        private readonly IBackOfficeSecurityAccessor _backOfficeSecurityAccessor;
        private readonly IHttpContextAccessor _httpContextAccessor;

        public LogoutController(IBackOfficeSecurityAccessor backOfficeSecurityAccessor, INotificationService notificationService, IHttpContextAccessor httpContextAccessor)
        {
            _backOfficeSecurityAccessor = backOfficeSecurityAccessor;
            _notificationService = notificationService;
            _httpContextAccessor = httpContextAccessor;
        }

        [HttpPost("logout")]
        [MapToApiVersion("1.0")]
        [ProducesResponseType(typeof(string), StatusCodes.Status200OK)]
        public IActionResult Logout()
        {
            IUser? user = _backOfficeSecurityAccessor?.BackOfficeSecurity?.CurrentUser;
            if (user == null)
            {
                return Unauthorized();
            }

            return Ok();
        }
    }
}
The policy [Authorize(Policy = AuthorizationPolicies.BackOfficeAccess)] Does not seem to be related/assigned to my role, what am i missing ?