prefect icon indicating copy to clipboard operation
prefect copied to clipboard

API_ERROR in GraphQL Interactive API

Open hemantmehra14 opened this issue 2 years ago • 3 comments

First check

  • [X] I added a descriptive title to this issue.
  • [X] I used the GitHub search to find a similar issue and didn't find it.
  • [X] I refreshed the page and this issue still occurred.
  • [X] I checked if this issue was specific to the browser I was using by testing with a different browser.

Bug summary

When running the following GraphQL query in Interactive UI

{
  log (
    where: {
      timestamp: {_gt: "2022-08-03T10:24:25.062468+00:00"}
    },
    order_by: {timestamp: asc},
    offset: 70,
    limit: 100
  ) {
    created,
    flow_run_id,
    id,
    info,
    is_audit_log,
    is_loaded_from_archive,
    level,
    message,
    name,
    object_id,
    object_table,
    task_run_id,
    tenant_id,
    timestamp,
    updated
  }
}

I got the following output:

{
  "errors": [
    {
      "path": [
        "log"
      ],
      "message": "Operation timed out",
      "extensions": {
        "code": "API_ERROR"
      }
    }
  ],
  "data": null
}

Reproduction

{
  log (
    where: {
      timestamp: {_gt: "2022-08-03T10:24:25.062468+00:00"}
    },
    order_by: {timestamp: asc},
    offset: 70,
    limit: 100
  ) {
    created,
    flow_run_id,
    id,
    info,
    is_audit_log,
    is_loaded_from_archive,
    level,
    message,
    name,
    object_id,
    object_table,
    task_run_id,
    tenant_id,
    timestamp,
    updated
  }
}

Error

{
  "errors": [
    {
      "path": [
        "log"
      ],
      "message": "Operation timed out",
      "extensions": {
        "code": "API_ERROR"
      }
    }
  ],
  "data": null
}

Browers

  • [X] Chrome
  • [ ] Firefox
  • [ ] Safari
  • [x] Edge

Prefect version


# Copy output of `prefect version` here if hosting your own UI

Additional context

No response

hemantmehra14 avatar Aug 05 '22 11:08 hemantmehra14

Hi! Generally v1 UI issues should be opened at PrefectHQ/ui, but this is actually an API limit. We enforce timeouts on queries to avoid slowdowns for other users. It looks like the query you're using isn't fast enough. Generally reducing the scope with the where clause will help.

zanieb avatar Aug 05 '22 15:08 zanieb

Is there a way to get the count of records before running the actual query ? So that I can request data in batch using limit and offset.

hemantmehra14 avatar Aug 05 '22 15:08 hemantmehra14

You can use aggregate calls e.g.

{
  flow_run_aggregate(
    where: {start_time: {_gt: "2022-08-03T10:24:25.062468+00:00"}}
  ) {
    aggregate {
      count
    }
  }
}

I'd recommend scoping your log queries to a single flow run at time.

zanieb avatar Aug 05 '22 15:08 zanieb

This issue is stale because it has been open 30 days with no activity. To keep this issue open remove stale label or comment.

github-actions[bot] avatar Mar 30 '23 18:03 github-actions[bot]

This issue was closed because it has been stale for 14 days with no activity. If this issue is important or you have more to add feel free to re-open it.

github-actions[bot] avatar Apr 13 '23 18:04 github-actions[bot]