Skip to content

Product.contentType.id connection errors and returns null #325

Closed
@TylerBarnes

Description

@TylerBarnes

Describe the bug
Product.contentType.id returns null along with an error.

To Reproduce
Steps to reproduce the behavior:
In a GraphQL client, make this query:

{
  products {
    nodes {
      contentType {
        node {
          name
        }
      }
    }
  }
}

The response will look like so:

{
  "errors": [
    {
      "debugMessage": "Argument 1 passed to WPGraphQL\\Connection\\ContentTypes::WPGraphQL\\Connection\\{closure}() must be an instance of WPGraphQL\\Model\\Post, instance of WPGraphQL\\WooCommerce\\Model\\Product given",
      "message": "Internal server error",
      "extensions": {
        "category": "internal"
      },
      "locations": [
        {
          "line": 4,
          "column": 7
        }
      ],
      "path": [
        "products",
        "nodes",
        0,
        "contentType"
      ]
    },
    {
      "debugMessage": "Argument 1 passed to WPGraphQL\\Connection\\ContentTypes::WPGraphQL\\Connection\\{closure}() must be an instance of WPGraphQL\\Model\\Post, instance of WPGraphQL\\WooCommerce\\Model\\Product given",
      "message": "Internal server error",
      "extensions": {
        "category": "internal"
      },
      "locations": [
        {
          "line": 4,
          "column": 7
        }
      ],
      "path": [
        "products",
        "nodes",
        1,
        "contentType"
      ]
    },
    {
      "debugMessage": "Argument 1 passed to WPGraphQL\\Connection\\ContentTypes::WPGraphQL\\Connection\\{closure}() must be an instance of WPGraphQL\\Model\\Post, instance of WPGraphQL\\WooCommerce\\Model\\Product given",
      "message": "Internal server error",
      "extensions": {
        "category": "internal"
      },
      "locations": [
        {
          "line": 4,
          "column": 7
        }
      ],
      "path": [
        "products",
        "nodes",
        2,
        "contentType"
      ]
    },
    {
      "debugMessage": "Argument 1 passed to WPGraphQL\\Connection\\ContentTypes::WPGraphQL\\Connection\\{closure}() must be an instance of WPGraphQL\\Model\\Post, instance of WPGraphQL\\WooCommerce\\Model\\Product given",
      "message": "Internal server error",
      "extensions": {
        "category": "internal"
      },
      "locations": [
        {
          "line": 4,
          "column": 7
        }
      ],
      "path": [
        "products",
        "nodes",
        3,
        "contentType"
      ]
    },
    {
      "debugMessage": "Argument 1 passed to WPGraphQL\\Connection\\ContentTypes::WPGraphQL\\Connection\\{closure}() must be an instance of WPGraphQL\\Model\\Post, instance of WPGraphQL\\WooCommerce\\Model\\Product given",
      "message": "Internal server error",
      "extensions": {
        "category": "internal"
      },
      "locations": [
        {
          "line": 4,
          "column": 7
        }
      ],
      "path": [
        "products",
        "nodes",
        4,
        "contentType"
      ]
    },
    {
      "debugMessage": "Argument 1 passed to WPGraphQL\\Connection\\ContentTypes::WPGraphQL\\Connection\\{closure}() must be an instance of WPGraphQL\\Model\\Post, instance of WPGraphQL\\WooCommerce\\Model\\Product given",
      "message": "Internal server error",
      "extensions": {
        "category": "internal"
      },
      "locations": [
        {
          "line": 4,
          "column": 7
        }
      ],
      "path": [
        "products",
        "nodes",
        5,
        "contentType"
      ]
    },
    {
      "debugMessage": "Argument 1 passed to WPGraphQL\\Connection\\ContentTypes::WPGraphQL\\Connection\\{closure}() must be an instance of WPGraphQL\\Model\\Post, instance of WPGraphQL\\WooCommerce\\Model\\Product given",
      "message": "Internal server error",
      "extensions": {
        "category": "internal"
      },
      "locations": [
        {
          "line": 4,
          "column": 7
        }
      ],
      "path": [
        "products",
        "nodes",
        6,
        "contentType"
      ]
    },
    {
      "debugMessage": "Argument 1 passed to WPGraphQL\\Connection\\ContentTypes::WPGraphQL\\Connection\\{closure}() must be an instance of WPGraphQL\\Model\\Post, instance of WPGraphQL\\WooCommerce\\Model\\Product given",
      "message": "Internal server error",
      "extensions": {
        "category": "internal"
      },
      "locations": [
        {
          "line": 4,
          "column": 7
        }
      ],
      "path": [
        "products",
        "nodes",
        7,
        "contentType"
      ]
    },
    {
      "debugMessage": "Argument 1 passed to WPGraphQL\\Connection\\ContentTypes::WPGraphQL\\Connection\\{closure}() must be an instance of WPGraphQL\\Model\\Post, instance of WPGraphQL\\WooCommerce\\Model\\Product given",
      "message": "Internal server error",
      "extensions": {
        "category": "internal"
      },
      "locations": [
        {
          "line": 4,
          "column": 7
        }
      ],
      "path": [
        "products",
        "nodes",
        8,
        "contentType"
      ]
    },
    {
      "debugMessage": "Argument 1 passed to WPGraphQL\\Connection\\ContentTypes::WPGraphQL\\Connection\\{closure}() must be an instance of WPGraphQL\\Model\\Post, instance of WPGraphQL\\WooCommerce\\Model\\Product given",
      "message": "Internal server error",
      "extensions": {
        "category": "internal"
      },
      "locations": [
        {
          "line": 4,
          "column": 7
        }
      ],
      "path": [
        "products",
        "nodes",
        9,
        "contentType"
      ]
    }
  ],
  "data": {
    "products": {
      "nodes": [
        {
          "contentType": null
        },
        {
          "contentType": null
        },
        {
          "contentType": null
        },
        {
          "contentType": null
        },
        {
          "contentType": null
        },
        {
          "contentType": null
        },
        {
          "contentType": null
        },
        {
          "contentType": null
        },
        {
          "contentType": null
        },
        {
          "contentType": null
        }
      ]
    }
  }
}

Expected behavior
This field should return a ContentType node connection.

Desktop (please complete the following information):

  • OS: Macos
  • Browser: N/A
  • Version: 0.5.1

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingfailing typeIssue concerns a failing/broken type

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions