3

I am learning GraphQL with react-apollo and wanted to look request in Chrome Devtools under Networks tab, but unfortunately I could see only this. enter image description here

Though I could see response with chrome extension called GraphQL Network. I am very curious, what can cause such behavior?

As I know it is impossible to hide AJAX response.

UPDATE

Status of request is success 200 and I can see data from server successfully, but I noticed one thing, that type of request instead of xhr is fetch.

enter image description here

I guess it is because used fetch API, though don't know should be any differences between them, aren't they same XHR?

Aren Hovsepyan
  • 1,947
  • 2
  • 17
  • 45

1 Answers1

1

The reason is because of the CORS. I presume you've not either configured the server to allow cross origin request or you have added 'no-cors' in the request header. In that case we are telling the browser to make the request, but we won't be allowed to view the response.(See Trying to use fetch and pass in mode: no-cors) However, surprisingly on checking developer tools for Firefox browser, I could see the response in the developer tools.

So as a solution, I would recommend you to configure your server config to allow cors request and other cors related parameters. See this for configuration values example if you are confused.

Note: For Drupal GraphQL users, It might be a wise idea to create a copy of default.services.yml => services.yml and change the cors configuration values in services.yml file.