Librum-Reader/Librum-Server

Access to the path '/librum_storage' is denied. Prevents login.

tenekev opened this issue · 4 comments

I'm using Docker to deploy Librum server. I'm using the latest windows client on Win11. The latest version introduces this error. I'm assuming the /librum_storage path is the one defined in the docker-compose.yml

    volumes:
      - librum:/var/lib/librum-server/librum_storage

I checked the container, the folder is there, the permissions are correct. This error appears only when a client tries to connect to the server and ultimately fails with a generic fail message.

Server log:

fail: Application.Common.Middleware.ExceptionHandlingMiddleware[0]
      Access to the path '/librum_storage' is denied.
      System.UnauthorizedAccessException: Access to the path '/librum_storage' is denied.
       ---> System.IO.IOException: Permission denied
         --- End of inner exception stack trace ---
         at System.IO.FileSystem.CreateDirectory(String fullPath, UnixFileMode unixCreateMode)
         at System.IO.Directory.CreateDirectory(String path)
         at Application.Managers.UserLocalStorageManager..ctor() in /app/src/Application/Managers/UserLocalStorageManager.cs:line 19
         at InvokeStub_UserLocalStorageManager..ctor(Object, Object, IntPtr*)
         at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)
         at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument)
         at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitRootCache(ServiceCallSite callSite, RuntimeResolverContext context)
         at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)
         at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument)
         at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitCache(ServiceCallSite callSite, RuntimeResolverContext context, ServiceProviderEngineScope serviceProviderEngine, RuntimeResolverLock lockType)
         at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)
         at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.Resolve(ServiceCallSite callSite, ServiceProviderEngineScope scope)
         at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope.GetService(Type serviceType)
         at lambda_method304(Closure, IServiceProvider, Object[])
         at Microsoft.AspNetCore.Mvc.Controllers.ControllerFactoryProvider.<>c__DisplayClass6_0.<CreateControllerFactory>g__CreateController|0(ControllerContext controllerContext)
         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.<InvokeNextResourceFilter>g__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
         at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
         at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync()
      --- End of stack trace from previous location ---
         at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
         at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
         at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
         at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
         at Application.Common.Middleware.ExceptionHandlingMiddleware.InvokeAsync(HttpContext context) in /app/src/Application/Common/Middleware/ExceptionHandlingMiddleware.cs:line 30

Client log

2023-12-19 | 13:09:54.751 | Warning   |                    in '          ' at line: 0 | "Getting User failed (500): {\"StatusCode\":500,\"Message\":\"An error occured\",\"StackTrace\":null}"

The server expects the storage at /librum-storage and not at /var/lib/librum-server/librum_storage as confirgured in the docker-compose.yaml.

So changing the volume to:

 volumes:
      - librum:/librum_storage

solves this issue for me.

The problem is dotnet tries to resolve app home directory, when it fails, it will look for /librum_storage in root, i'll make a fix.

Please confirm that #23 fixed this issue.

I can confirm it fixed the issue for me. Thanks you.