title: Unable to connect to AWS gamelift Test local server using AWS Javascript SDK, network and CORS error
body: <p>as advised and since there are no Javascript client SDK for gamelift, I used the AWS javascript SDK.</p>
  <p><a href="https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/GameLift.html#constructor-property" rel="nofollow noreferrer">https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/GameLift.html#constructor-property</a></p>
  <p>However, i cannot seem to work it,</p>
  <p>I have run the local test gamelift server for testing and I can communicate it using the aws CLI command like this</p>
  <pre><code>AWS gamelift describe-game-sessions --endpoint-url http://localhost:9080 --fleet-id fleet-123
  </code></pre>
  <p>However, when I attempt to connect from a standalone javascript (in an HTML), i am getting
  Network error if I set the endpoint to 9080 (same as the CLI above).</p>
  <p>I checked the local server terminal and it shows 3 more ports open, 5757, 5758, and 5759.</p>
  <p>I tried to connect to 5758 as it says its an SDK port. But now I am getting CORS error</p>
  <pre><code>Access to XMLHttpRequest at 'http://localhost:5758/' from origin 'http://localhost:3000' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
  </code></pre>
  <p>Is there any sample to connect to Gamelift server using AWS Javascript SDK?</p>
  <p>here is my code</p>
  <pre><code>    &lt;script src=&quot;https://cdnjs.cloudflare.com/ajax/libs/aws-sdk/2.1085.0/aws-sdk.js&quot; integrity=&quot;sha512-P8mvO6DiBR/wJa/s5Z24/UimPqKZEHjTle0Z8Fb4cSPE+x7QDJu+E1QO/YO7BP8Ek19I2Y+C8xuCZCaBtZKmZA==&quot; crossorigin=&quot;anonymous&quot; referrerpolicy=&quot;no-referrer&quot;&gt;&lt;/script&gt;
  
      &lt;script&gt;
          var gamelift = new AWS.GameLift(
  
              {endpoint : 'http://localhost:5758',
  
              accessKeyId :'abcde',
  
              secretAccessKey:'abcde',
  
              region:'us-west-2'});
  
          var params = {
  
              FleetId: 'fleet-123d',
  
          };
  
          gamelift.describeGameSessions(params, function(err, data) {
  
              if (err)
  
                  console.log(err);
  
                  //console.log(err, err.stack); // an error occurred
  
              else    
  
                  console.log(data);           // successful response
  
          });
  
      &lt;/script&gt;
  </code></pre>
  <p>Anyone can help?</p>