Skip to content

GraphQL Query results in Internal Server Error for Nullable Fields #778

@donicrosby

Description

@donicrosby

Describe the bug
When querying the GraphQL API for Interfaces (this problem likely exists for other models), if you query for a field that doesn't exist in the config.xml but does exist in the Object's model and schema and it is a nullable field it throws an Internal Server Error for that object.

To Reproduce
Steps to reproduce the behavior:

Here is the simplest way to recreate the issue based on my environment:

  1. Have or create at least two Interfaces in the UI, ensure that one is using DHCP and the other is a Static IP (I'm using IPv4 here but IPv6 will also likely work as well)
  2. Perform this GraphQL Query:
{
  queryInterfaces {
    id,
    descr,
    ipaddr,
    subnet
  }
}
  1. You'll notice the DHCP interface causes an Internal server error and is null in the output but the Static IP interface will return the expected values.

Expected behavior
When you query for a field in an object that is nullable and it doesn't exist on the specific object it should return null for that field instead of throwing the error.

Screenshots or Response
If applicable, add screenshots or response data to help explain your problem.

Image

pfSense Version & Package Version:

  • pfSense Version: 2.8.1-RELEASE
  • Package Version: v2.6.1

Affected Endpoints:

  • URL: /api/v2/graphql/

Additional context
N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions