Skip to content

HTTP500 when editing a sub #109

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

Open
bvandewe opened this issue Apr 24, 2025 · 1 comment
Open

HTTP500 when editing a sub #109

bvandewe opened this issue Apr 24, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@bvandewe
Copy link
Collaborator

I tried this:

  • Manually edited the offset for a sub. (e.g. current offset was set to 36 while the ackedOffset was 128, i wanted to restream the very last event, so had to set the offset to 127).

This happened:

  • The UI gives no feedback about the edit but the event was re-streamed
  • The sub still shows the original offset 36
  • Trying to edit the same sub again will result in HTTP500 and nothing is shown on the UI (user doesnt know if the edit was successful or not)
  • Followings logs are seen on the gateway:

fail: Microsoft.AspNetCore.Server.Kestrel[13]
      Connection id "0HNC1HDPA5677", Request id "0HNC1HDPA5677:00000002": An unhandled exception was thrown by the application.
      Neuroglia.ProblemDetailsException: [400 - Validation Failed] Failed to apply the specified patch to resource 'cloud-streams.io/v1/subscriptions/business-operation-manager_session-manager.session.created.v1': the patch document is invalid and/or includes operations that target properties that do not belong to the 'spec' root element.
         at Neuroglia.Data.Infrastructure.ResourceOriented.Services.ResourceRepository.PatchAsync(Patch patch, String group, String version, String plural, String name, String namespace, String resourceVersion, Boolean dryRun, CancellationToken cancellationToken) in /home/runner/work/framework/framework/src/Neuroglia.Data.Infrastructure.ResourceOriented/Services/ResourceRepository.cs:line 184
         at Neuroglia.Data.Infrastructure.ResourceOriented.IResourceRepositoryExtensions.PatchAsync[TResource](IResourceRepository repository, Patch patch, String name, String namespace, String resourceVersion, Boolean dryRun, CancellationToken cancellationToken) in /home/runner/work/framework/framework/src/Neuroglia.Data.Infrastructure.ResourceOriented.Abstractions/Extensions/IResourceRepositoryExtensions.cs:line 226
         at CloudStreams.Core.Application.Commands.Resources.Generic.PatchResourceCommandHandler`1.HandleAsync(PatchResourceCommand`1 command, CancellationToken cancellationToken) in /src/src/core/CloudStreams.Core.Application/Commands/Resources/Generic/PatchResourceCommand.cs:line 76
         at Neuroglia.Mediation.RequestPipeline`2.HandleAsync(IRequest`1 request, IServiceProvider serviceProvider, CancellationToken cancellationToken)
         at Neuroglia.Mediation.Mediator.ExecuteAsync[TResult](IRequest`1 request, CancellationToken cancellationToken)
         at CloudStreams.Core.Api.ClusterResourceApiController`1.PatchResource(String name, Patch patch, Boolean dryRun, CancellationToken cancellationToken) in /src/src/core/CloudStreams.Core.Api/ClusterResourceApiController.cs:line 57
         at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.TaskOfIActionResultExecutor.Execute(ActionContext actionContext, IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
         at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Logged|12_1(ControllerActionInvoker invoker)
         at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
         at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
         at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
         at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeInnerFilterAsync>g__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
         at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeFilterPipelineAsync>g__Awaited|20_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
         at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Logged|17_1(ResourceInvoker invoker)
         at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Logged|17_1(ResourceInvoker invoker)
         at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware.Invoke(HttpContext httpContext)
         at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider)
         at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
         at Microsoft.AspNetCore.ResponseCompression.ResponseCompressionMiddleware.InvokeCore(HttpContext context)
         at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
         at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests[TContext](IHttpApplication`1 application)

I expected this:

when editing a sub, it'd be great if the UI could give some feedback whether the edit was successful or not, and also when an edit was successful, it'd be great to see it on the UI

Is there a workaround?

Delete the sub and create it again.

Anything else?

No response

Component(s)

No response

Platform(s)

No response

Community Notes

  • Please vote by adding a 👍 reaction to the issue to help us prioritize.
  • If you are interested to work on this issue, please leave a comment.name: Bug Report 🐞
@bvandewe bvandewe added the bug Something isn't working label Apr 24, 2025
@bvandewe
Copy link
Collaborator Author

bvandewe commented Apr 24, 2025

  • the edit was on the spec.stream.offset key
  • the sub was created originally with offset = 36
  • the first edit set the offset to 127 (which was the stream' length -1; to re-stream the last event)
  • this first edit succeeded on the backend (the last event was re-streamed) but the UI still showed the original offset 36
  • any further edit on the sub will then result in this 500
  • refreshing the view doesnt change anything (i.e. the sub' offset doesnt appear to be reflected on subsequent calls to the backend; no clue if the edit was persisted or not, in any case the frontend always sees the original offset;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant