title: Why does Apollo Client ignore the response even though I have 200 status
body: <p>I'm in the process of duplicating AWS services with LocalStack.</p>
  <p>I've got my Lambda and API Gateway running in LocalStack in much the same way as they would in AWS. I've tested using a Rest API tool to verify. However, when I run the same query within a browser using an Apollo Client, the LocalStack version no longer works.</p>
  <p>I've tried 3 different browsers for a given GraphQL and only Firefox shows any data when I inspect via the Network tab. Apollo always errors with a JSON decode error at position 1. The request always returns a 200 status code.</p>
  <p>Our client setup is:</p>
  <pre class="lang-js prettyprint-override"><code>import { ApolloClient, InMemoryCache, createHttpLink } from '@apollo/client';
  import 'cross-fetch/polyfill';
  
  const httpLink = createHttpLink({
    uri: 'http://example.com/graphql',
    credentials: 'include', // Allow other domains too
    fetchOptions: {
      mode:  'no-cors',
    },
  });
  
  export const client = new ApolloClient({
    link: httpLink,
    credentials: 'include',
    cache: new InMemoryCache(),
  });
  </code></pre>
  <p>Is it possible to have some CORS issue within Apollo? I'm pretty sure I have the headers set correctly in the gateway, <code>access-control-allow-origin: http://localhost:3000</code>, <code>Content-Type: application/json</code>, and so on.</p>
  <p>Has anyone seen anything like these kinds of errors?</p>
  <p><strong>Update</strong></p>
  <p>I've found that switching from <code>no-cors</code> to <code>cors</code> allows it to work using a known good URL.<br />
  It seems to that:</p>
  <ul>
  <li>when <code>cors</code> is set, there is a preflight check. This <code>OPTIONS</code> request provides a number of response headers of which the <code>Access-Control-Allow-Origin</code> must be set to the requesting domain.</li>
  <li>when <code>no-cors</code> is set there is no preflight check and for whatever reason, the response is then rejected, even though that too contains the correct <code>Access-Control-Allow-Origin</code>. <em>I tested using an URL that worked with the <code>cors</code> option</em>.</li>
  </ul>
  <p><strong>In Summary</strong></p>
  <ol>
  <li>At this point in time, LocalStack is unable to provide the correct <code>OPTIONS</code> response, see <a href="https://github.com/localstack/localstack/issues/4204" rel="nofollow noreferrer">https://github.com/localstack/localstack/issues/4204</a> and that prevents me from using <code>cors</code>.</li>
  <li>Using <code>no-cors</code> fails, even when I use a known good URL.</li>
  </ol>
  <p>I've abandoned LocalStack and switched to using API Gateway from AWS directly.</p>
  <p>I hope this helps.</p>