Skip to content
This repository has been archived by the owner on Dec 19, 2019. It is now read-only.

Non existent category with products query results in an error #310

Closed
ldusan84 opened this issue Jan 3, 2019 · 1 comment
Closed

Non existent category with products query results in an error #310

ldusan84 opened this issue Jan 3, 2019 · 1 comment
Assignees
Labels
bug Something isn't working Component: CatalogGraphQl

Comments

@ldusan84
Copy link
Contributor

ldusan84 commented Jan 3, 2019

A query for non existent category with products count shouldn't result in an error, I think it should return "category": null as it does for the other category queries.

Preconditions (*)

Magento 2.3
Sample data

Steps to reproduce (*)

{
  category(id: 99) {
    product_count
  }
}

Expected result (*)

{
  "data": {
    "category": null
  }
}

Actual result (*)

{
  "errors": [
    {
      "debugMessage": "Argument 4 passed to Magento\\CatalogGraphQl\\Model\\Resolver\\Category\\ProductsCount::resolve() must be of the type array or null, boolean given, called in /var/www/html/graphql-ce/lib/internal/Magento/Framework/GraphQl/Schema/Type/Output/ElementMapper/Formatter/Fields.php on line 161",
      "message": "Internal server error",
      "category": "internal",
      "locations": [
        {
          "line": 3,
          "column": 5
        }
      ],
      "path": [
        "category",
        "product_count"
      ],
      "trace": [
        {
          "file": "/var/www/html/graphql-ce/lib/internal/Magento/Framework/GraphQl/Schema/Type/Output/ElementMapper/Formatter/Fields.php",
          "line": 161,
          "call": "Magento\\CatalogGraphQl\\Model\\Resolver\\Category\\ProductsCount::resolve(instance of Magento\\Framework\\GraphQl\\Config\\Element\\Field, instance of Magento\\GraphQl\\Model\\Query\\Resolver\\Context, instance of Magento\\Framework\\GraphQl\\Schema\\Type\\ResolveInfo, false, array(0))"
        },
        {
          "file": "/var/www/html/graphql-ce/vendor/webonyx/graphql-php/src/Executor/Executor.php",
          "line": 781,
          "call": "Magento\\Framework\\GraphQl\\Schema\\Type\\Output\\ElementMapper\\Formatter\\Fields::Magento\\Framework\\GraphQl\\Schema\\Type\\Output\\ElementMapper\\Formatter\\{closure}(false, array(0), instance of Magento\\GraphQl\\Model\\Query\\Resolver\\Context, instance of GraphQL\\Type\\Definition\\ResolveInfo)"
        },
        {
          "file": "/var/www/html/graphql-ce/vendor/webonyx/graphql-php/src/Executor/Executor.php",
          "line": 744,
          "call": "GraphQL\\Executor\\Executor::resolveOrError(instance of GraphQL\\Type\\Definition\\FieldDefinition, instance of GraphQL\\Language\\AST\\FieldNode, instance of Closure, false, instance of Magento\\GraphQl\\Model\\Query\\Resolver\\Context, instance of GraphQL\\Type\\Definition\\ResolveInfo)"
        },
        {
          "file": "/var/www/html/graphql-ce/vendor/webonyx/graphql-php/src/Executor/Executor.php",
          "line": 473,
          "call": "GraphQL\\Executor\\Executor::resolveField(GraphQLType: CategoryTree, false, instance of ArrayObject(1), array(2))"
        },
        {
          "file": "/var/www/html/graphql-ce/vendor/webonyx/graphql-php/src/Executor/Executor.php",
          "line": 1321,
          "call": "GraphQL\\Executor\\Executor::executeFields(GraphQLType: CategoryTree, false, array(1), instance of ArrayObject(1))"
        },
        {
          "file": "/var/www/html/graphql-ce/vendor/webonyx/graphql-php/src/Executor/Executor.php",
          "line": 1280,
          "call": "GraphQL\\Executor\\Executor::collectAndExecuteSubfields(GraphQLType: CategoryTree, instance of ArrayObject(1), instance of GraphQL\\Type\\Definition\\ResolveInfo, array(1), false)"
        },
        {
          "file": "/var/www/html/graphql-ce/vendor/webonyx/graphql-php/src/Executor/Executor.php",
          "line": 997,
          "call": "GraphQL\\Executor\\Executor::completeObjectValue(GraphQLType: CategoryTree, instance of ArrayObject(1), instance of GraphQL\\Type\\Definition\\ResolveInfo, array(1), false)"
        },
        {
          "file": "/var/www/html/graphql-ce/vendor/webonyx/graphql-php/src/Executor/Executor.php",
          "line": 876,
          "call": "GraphQL\\Executor\\Executor::completeValue(GraphQLType: CategoryTree, instance of ArrayObject(1), instance of GraphQL\\Type\\Definition\\ResolveInfo, array(1), false)"
        },
        {
          "file": "/var/www/html/graphql-ce/vendor/webonyx/graphql-php/src/Executor/Executor.php",
          "line": 830,
          "call": "GraphQL\\Executor\\Executor::completeValueWithLocatedError(GraphQLType: CategoryTree, instance of ArrayObject(1), instance of GraphQL\\Type\\Definition\\ResolveInfo, array(1), false)"
        },
        {
          "file": "/var/www/html/graphql-ce/vendor/webonyx/graphql-php/src/Executor/Executor.php",
          "line": 752,
          "call": "GraphQL\\Executor\\Executor::completeValueCatchingError(GraphQLType: CategoryTree, instance of ArrayObject(1), instance of GraphQL\\Type\\Definition\\ResolveInfo, array(1), false)"
        },
        {
          "file": "/var/www/html/graphql-ce/vendor/webonyx/graphql-php/src/Executor/Executor.php",
          "line": 473,
          "call": "GraphQL\\Executor\\Executor::resolveField(GraphQLType: Query, null, instance of ArrayObject(1), array(1))"
        },
        {
          "file": "/var/www/html/graphql-ce/vendor/webonyx/graphql-php/src/Executor/Executor.php",
          "line": 349,
          "call": "GraphQL\\Executor\\Executor::executeFields(GraphQLType: Query, null, array(0), instance of ArrayObject(1))"
        },
        {
          "file": "/var/www/html/graphql-ce/vendor/webonyx/graphql-php/src/Executor/Executor.php",
          "line": 309,
          "call": "GraphQL\\Executor\\Executor::executeOperation(instance of GraphQL\\Language\\AST\\OperationDefinitionNode, null)"
        },
        {
          "file": "/var/www/html/graphql-ce/vendor/webonyx/graphql-php/src/Executor/Promise/Adapter/SyncPromiseAdapter.php",
          "line": 59,
          "call": "GraphQL\\Executor\\Executor::GraphQL\\Executor\\{closure}(array(2), array(2))"
        },
        {
          "file": "/var/www/html/graphql-ce/vendor/webonyx/graphql-php/src/Executor/Executor.php",
          "line": 310,
          "call": "GraphQL\\Executor\\Promise\\Adapter\\SyncPromiseAdapter::create(instance of Closure)"
        },
        {
          "file": "/var/www/html/graphql-ce/vendor/webonyx/graphql-php/src/Executor/Executor.php",
          "line": 166,
          "call": "GraphQL\\Executor\\Executor::doExecute()"
        },
        {
          "file": "/var/www/html/graphql-ce/vendor/webonyx/graphql-php/src/GraphQL.php",
          "line": 155,
          "call": "GraphQL\\Executor\\Executor::promiseToExecute(instance of GraphQL\\Executor\\Promise\\Adapter\\SyncPromiseAdapter, instance of Magento\\Framework\\GraphQl\\Schema, instance of GraphQL\\Language\\AST\\DocumentNode, null, instance of Magento\\GraphQl\\Model\\Query\\Resolver\\Context, array(0), null, null)"
        },
        {
          "file": "/var/www/html/graphql-ce/vendor/webonyx/graphql-php/src/GraphQL.php",
          "line": 86,
          "call": "GraphQL\\GraphQL::promiseToExecute(instance of GraphQL\\Executor\\Promise\\Adapter\\SyncPromiseAdapter, instance of Magento\\Framework\\GraphQl\\Schema, '{\n  category(id: 99) {\n    product_count\n  }\n}', null, instance of Magento\\GraphQl\\Model\\Query\\Resolver\\Context, array(0), null, null, null)"
        },
        {
          "file": "/var/www/html/graphql-ce/lib/internal/Magento/Framework/GraphQl/Query/QueryProcessor.php",
          "line": 69,
          "call": "GraphQL\\GraphQL::executeQuery(instance of Magento\\Framework\\GraphQl\\Schema, '{\n  category(id: 99) {\n    product_count\n  }\n}', null, instance of Magento\\GraphQl\\Model\\Query\\Resolver\\Context, array(0), null)"
        },
        {
          "file": "/var/www/html/graphql-ce/app/code/Magento/GraphQl/Controller/GraphQl.php",
          "line": 124,
          "call": "Magento\\Framework\\GraphQl\\Query\\QueryProcessor::process(instance of Magento\\Framework\\GraphQl\\Schema, '{\n  category(id: 99) {\n    product_count\n  }\n}', instance of Magento\\GraphQl\\Model\\Query\\Resolver\\Context, array(0))"
        },
        {
          "file": "/var/www/html/graphql-ce/lib/internal/Magento/Framework/Interception/Interceptor.php",
          "line": 58,
          "call": "Magento\\GraphQl\\Controller\\GraphQl::dispatch(instance of Magento\\Framework\\App\\Request\\Http)"
        },
        {
          "file": "/var/www/html/graphql-ce/lib/internal/Magento/Framework/Interception/Interceptor.php",
          "line": 138,
          "call": "Magento\\GraphQl\\Controller\\GraphQl\\Interceptor::___callParent('dispatch', array(1))"
        },
        {
          "file": "/var/www/html/graphql-ce/lib/internal/Magento/Framework/Interception/Interceptor.php",
          "line": 153,
          "call": "Magento\\GraphQl\\Controller\\GraphQl\\Interceptor::Magento\\Framework\\Interception\\{closure}(instance of Magento\\Framework\\App\\Request\\Http)"
        },
        {
          "file": "/var/www/html/graphql-ce/generated/code/Magento/GraphQl/Controller/GraphQl/Interceptor.php",
          "line": 26,
          "call": "Magento\\GraphQl\\Controller\\GraphQl\\Interceptor::___callPlugins('dispatch', array(1), array(1))"
        },
        {
          "file": "/var/www/html/graphql-ce/lib/internal/Magento/Framework/App/Http.php",
          "line": 135,
          "call": "Magento\\GraphQl\\Controller\\GraphQl\\Interceptor::dispatch(instance of Magento\\Framework\\App\\Request\\Http)"
        },
        {
          "file": "/var/www/html/graphql-ce/lib/internal/Magento/Framework/App/Bootstrap.php",
          "line": 257,
          "call": "Magento\\Framework\\App\\Http::launch()"
        },
        {
          "file": "/var/www/html/graphql-ce/index.php",
          "line": 39,
          "call": "Magento\\Framework\\App\\Bootstrap::run(instance of Magento\\Framework\\App\\Http\\Interceptor)"
        }
      ]
    }
  ],
  "data": {
    "category": {
      "product_count": null
    }
  }
}
@naydav naydav added this to the Release: 2.3.2 milestone Mar 13, 2019
@naydav naydav added the bug Something isn't working label Mar 13, 2019
@naydav
Copy link
Contributor

naydav commented Mar 13, 2019

#311

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working Component: CatalogGraphQl
Projects
None yet
Development

No branches or pull requests

3 participants