Unexpected end of JSON on GraphQL query with React while no issue with GraphiQL

Ok, i found it.

  1. First issue was that i used no-cors option on the ApolloClient Which prevents it from ready the data thus sending back a empty data object.

  2. Second issue was that I needed to set my CORS headers on my GraphQL server properly, just for development accepting all with a * that solved it for the development phase.

  3. Third and last issue was that Apollo sends a OPTIONS request to preflight check the CORS headers to see if its all allowed. Magento 2.3 flipped over that because its an empty request thus providing you with a Unable to unserialize value error.

What i did to solve that third issue is temporary patching a core file during deployment. The following file needs to be changed: /vendor/magento/module-graph-ql/Controller/GraphQl.php

on line 111 the following is needed

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

I think there are other solutions for this on the React / Apollo side but haven't found that one yet.