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

GraphQL single-object endpoints broken #1112

Closed
jdrew82 opened this issue Nov 30, 2021 · 2 comments · Fixed by #1120
Closed

GraphQL single-object endpoints broken #1112

jdrew82 opened this issue Nov 30, 2021 · 2 comments · Fixed by #1120
Assignees
Labels
type: bug Something isn't working as expected
Milestone

Comments

@jdrew82
Copy link
Contributor

jdrew82 commented Nov 30, 2021

Environment

  • Python version: 3.7
  • Nautobot version: 1.2.0-beta1

Steps to Reproduce

  1. Build Nautobot instance of 1.2.0-beta1.
  2. Add some sample devices and associated data.
  3. Attempt to use the GraphiQL endpoint with a simple query such as:
query ($device_id: ID!) {
  device(id: $device_id) {
    hostname: name
  }
}

along with one of your device's UUID as the query.

Expected Behavior

Expect to see the device's hostname returned.

Observed Behavior

Get error with following:

{
  "errors": [
    {
      "message": "'Device' object has no attribute 'only'",
      "locations": [
        {
          "line": 2,
          "column": 3
        }
      ],
      "path": [
        "device"
      ]
    }
  ],
  "data": {
    "device": null
  }
}

A larger query returns this:

{
  "errors": [
    {
      "message": "'Device' object has no attribute 'select_related'",
      "locations": [
        {
          "line": 2,
          "column": 3
        }
      ],
      "path": [
        "device"
      ]
    }
  ],
  "data": {
    "device": null
  }
}

This appears to be related to optimizations that were done in the core.

@glennmatthews glennmatthews added the type: bug Something isn't working as expected label Nov 30, 2021
@glennmatthews glennmatthews added this to the v1.2.0 milestone Nov 30, 2021
@glennmatthews
Copy link
Contributor

Probably a regression introduced by #769.

@glennmatthews
Copy link
Contributor

Seems to be specifically an issue with "single" queries (e.g. device as opposed to devices.) The corresponding devices query seems to work fine:

query ($device_id: String!) {
  devices (id: [$device_id]) {
    hostname: name
  }
}

@glennmatthews glennmatthews self-assigned this Dec 2, 2021
@glennmatthews glennmatthews changed the title GraphQL endpoint broken GraphQL single-object endpoints broken Dec 2, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 4, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: bug Something isn't working as expected
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants