1

I'm trying out the GraphQL API on the 2.3-develop branch. On a clean Magento install, all queries return:

 "errors": [
        {
            "debugMessage": "Unable to unserialize value.",
            "message": "Internal server error",
            "category": "internal",
            "trace": [
                {
                    "file": "/magento/app/code/Magento/GraphQl/Controller/GraphQl.php",
                    "line": 102,
                    "call": "Magento\\Framework\\Serialize\\Serializer\\Json::unserialize('{\n    products(search: \" \"){\n        total_count\n\t}\n}')"
                },
            {

I'm sending a HTTP POST request to http://magento-shop-host/graphql

With the headers:

  • Accept: application/json
  • Content-Type: application/json

2 Answers 2

0

run php bin/magento setup:upgrade

0
0

I had the same issue and was not able to fix it so far. The only thing i managed to get this solved is doing the following:

in the file /vendor/magento/module-graph-ql/Controller/GraphQl.php On line 102 (or in a later version line 111) you have the following

$data = $this->jsonSerializer->unserialize($request->getContent());

I replaced this via a composer patch with the following

$content = ($request->getContent() === '') ? '{}' : $request->getContent();
$data = $this->jsonSerializer->unserialize($content);

I had this issue of GraphiQL requests working perfectly. but upon implementing this same query with react-apollo it preflight checks with a OPTIONS query that will return an Unable to unserialize value error.

Hopefully this will help other

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.