sillsdev / languageforge-lexbox

Lexbox, SIL linguistic data hub
MIT License
7 stars 2 forks source link

project page will forever spam gql requests when projectChangesets returns a 404 #1259

Open hahn-kev opened 1 day ago

hahn-kev commented 1 day ago

Describe the bug When I open the elawa project on my local instance it opens an error page, but the error code is constantly changing, this is because the backend is being flooded with as many requests as it can all of which are failing due to hgweb returning a 404 for a project. Here's the query:

query projectChangesets($projectCode: String!) {
  projectByCode(code: $projectCode) {
    id
    code
    changesets {
      node
      rev
      parents
      date
      user
      desc
      __typename
    }
    __typename
  }
}

here's the response from the server

{
  "errors": [
    {
      "message": "Unexpected Execution Error",
      "locations": [
        {
          "line": 5,
          "column": 5
        }
      ],
      "path": [
        "projectByCode",
        "changesets"
      ],
      "extensions": {
        "message": "Response status code does not indicate success: 404 (Not Found).",
        "stackTrace": "   at System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode()\n   at LexBoxApi.Services.HgService.GetResponseMessage(ProjectCode code, String requestPath) in /src/backend/LexBoxApi/Services/HgService.cs:line 50\n   at LexBoxApi.Services.HgService.GetChangesets(ProjectCode projectCode) in /src/backend/LexBoxApi/Services/HgService.cs:line 362\n   at LexCore.Entities.Project.GetChangesets(IHgService hgService) in /src/backend/LexCore/Entities/Project.cs:line 47\n   at HotChocolate.Resolvers.Expressions.ExpressionHelper.AwaitTaskHelper[T](Task`1 task)\n   at HotChocolate.Types.Helpers.FieldMiddlewareCompiler.<>c__DisplayClass9_0.<<CreateResolverMiddleware>b__0>d.MoveNext()\n--- End of stack trace from previous location ---\n   at DataAnnotatedModelValidations.Middleware.ValidatorMiddleware.InvokeAsync(IMiddlewareContext context)\n   at HotChocolate.Utilities.MiddlewareCompiler`1.ExpressionHelper.AwaitTaskHelper(Task task)\n   at HotChocolate.Execution.Processing.Tasks.ResolverTask.ExecuteResolverPipelineAsync(CancellationToken cancellationToken)\n   at HotChocolate.Execution.Processing.Tasks.ResolverTask.TryExecuteAsync(CancellationToken cancellationToken)"
      }
    }
  ],
  "data": {
    "projectByCode": null
  }
}

here's that stack trace:

[lexbox-api]       ResolverError: Unexpected Execution Error
[lexbox-api]       System.Net.Http.HttpRequestException: Response status code does not indicate success: 404 (Not Found).
[lexbox-api]          at System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode()
[lexbox-api]          at LexBoxApi.Services.HgService.GetResponseMessage(ProjectCode code, String requestPath) in /src/backend/LexBoxApi/Services/HgService.cs:line 50
[lexbox-api]          at LexBoxApi.Services.HgService.GetChangesets(ProjectCode projectCode) in /src/backend/LexBoxApi/Services/HgService.cs:line 362
[lexbox-api]          at LexCore.Entities.Project.GetChangesets(IHgService hgService) in /src/backend/LexCore/Entities/Project.cs:line 47
[lexbox-api]          at HotChocolate.Resolvers.Expressions.ExpressionHelper.AwaitTaskHelper[T](Task`1 task)
[lexbox-api]          at HotChocolate.Types.Helpers.FieldMiddlewareCompiler.<>c__DisplayClass9_0.<<CreateResolverMiddleware>b__0>d.MoveNext()
[lexbox-api]       --- End of stack trace from previous location ---
[lexbox-api]          at DataAnnotatedModelValidations.Middleware.ValidatorMiddleware.InvokeAsync(IMiddlewareContext context)
[lexbox-api]          at HotChocolate.Utilities.MiddlewareCompiler`1.ExpressionHelper.AwaitTaskHelper(Task task)
[lexbox-api]          at HotChocolate.Execution.Processing.Tasks.ResolverTask.ExecuteResolverPipelineAsync(CancellationToken cancellationToken)
[lexbox-api]          at HotChocolate.Execution.Processing.Tasks.ResolverTask.TryExecuteAsync(CancellationToken cancellationToken)

To Reproduce I haven't tried this out but I suspect it'll work:

  1. create a project, maybe make sure the repo has data
  2. delete the repo folder
  3. try to open the project

Expected behavior the error should still show, but only once