Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Weird exception in background #529

Open
JornWildt opened this issue Mar 18, 2023 · 1 comment
Open

Weird exception in background #529

JornWildt opened this issue Mar 18, 2023 · 1 comment

Comments

@JornWildt
Copy link

Once in a while I get this exception after a MVC controller has completed, on a page with no editor in it:

This exception was originally thrown at this call stack:
    [External Code]
    AspNetCore._Admin_Modules_VisualEditor_MVC_Views_Frame.ExecuteAsync.AnonymousMethod__1() in Frame.cshtml

fail: Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware[1]
      An unhandled exception has occurred while executing the request.
      Cofoundry.Domain.PermissionValidationFailedException: Permission Validation Check Failed. Permission Type: Cofoundry.Domain.RoleReadPermission. UserId: 5
         at Cofoundry.Domain.Internal.PermissionValidationService.EnforcePermission(IPermissionApplication permission, IUserContext userContext)
         at Cofoundry.Domain.Internal.PermissionValidationService.EnforcePermission(IEnumerable`1 permissions, IUserContext userContext)
         at Cofoundry.Domain.Internal.ExecutePermissionValidationService.Validate[TQuery,TResult](TQuery query, IQueryHandler`2 queryHandler, IExecutionContext executionContext)
         at Cofoundry.Domain.CQS.Internal.QueryExecutor.ExecuteQueryAsync[TQuery,TResult](TQuery query, IExecutionContext executionContext)
         at Cofoundry.Domain.CQS.Internal.QueryExecutor.ExecuteAsync[TResult](IQuery`1 query, IExecutionContext executionContext)
         at Cofoundry.Web.Admin.AngularBootstrapper.RenderBootstrapperAsync(AngularModuleRouteLibrary routeLibrary, Object options)
         at Cofoundry.Web.Admin.AngularBootstrapper.BootstrapAsync(AngularModuleRouteLibrary routeLibrary, Object options)
         at AspNetCore._Admin_Modules_VisualEditor_MVC_Views_Frame.<>c__DisplayClass9_0.<<ExecuteAsync>b__1>d.MoveNext() in /Admin/Modules/VisualEditor/MVC/Views/Frame.cshtml:line 29
      --- End of stack trace from previous location ---
         at Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperExecutionContext.SetOutputContentAsync()
         at AspNetCore._Admin_Modules_VisualEditor_MVC_Views_Frame.ExecuteAsync() in /Admin/Modules/VisualEditor/MVC/Views/Frame.cshtml:line 7
         at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderPageCoreAsync(IRazorPage page, ViewContext context)
         at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderPageAsync(IRazorPage page, ViewContext context, Boolean invokeViewStarts)
         at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderAsync(ViewContext context)
         at Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor.ExecuteAsync(ViewContext viewContext, String contentType, Nullable`1 statusCode)
         at Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor.ExecuteAsync(ViewContext viewContext, String contentType, Nullable`1 statusCode)
         at Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor.ExecuteAsync(ActionContext actionContext, IView view, ViewDataDictionary viewData, ITempDataDictionary tempData, String contentType, Nullable`1 statusCode)
         at Microsoft.AspNetCore.Mvc.ViewFeatures.ViewResultExecutor.ExecuteAsync(ActionContext context, ViewResult result)
         at Microsoft.AspNetCore.Mvc.ViewResult.ExecuteResultAsync(ActionContext context)
         at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResultFilterAsync>g__Awaited|30_0[TFilter,TFilterAsync](ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
         at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResultExecutedContextSealed context)
         at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.ResultNext[TFilter,TFilterAsync](State& next, Scope& scope, Object& state, Boolean& isCompleted)
         at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeResultFilters()
      --- 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.Rethrow(ResourceExecutedContextSealed context)
         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.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
         at Cofoundry.Web.AutoUpdateMiddleware.Invoke(HttpContext cx)
         at Microsoft.AspNetCore.Authorization.Policy.AuthorizationMiddlewareResultHandler.HandleAsync(RequestDelegate next, HttpContext context, AuthorizationPolicy policy, PolicyAuthorizationResult authorizeResult)
         at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
         at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
         at Microsoft.AspNetCore.Diagnostics.StatusCodePagesMiddleware.Invoke(HttpContext context)
         at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)

The user ID 5 is not the currently signed-in user (which is user ID 6).

I am experimenting with user sign-in so there may very well be something wrong with user ID 5 ... but what happens here? The issue only shows in the log and not in the browser.

@HeyJoel
Copy link
Member

HeyJoel commented Mar 20, 2023

I expect this is related to #530, whereby one of your user accounts does not have role access permissions. Bear in mind that if you have multiple user areas, it is possible to be logged into both areas at the same time. So if user 5 and 6 are from different user areas, it is possible to be logged in at the same time. More info in the docs for the ambient user area.

Either way I'll have to look into it. As mentioned in #530 it might be that a better exception message can be thrown here if it is a known configuration error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants