title: AWS Amplify API Gateway cors error after using authorizer: aws_iam
body: <p>I have API Gateway endpoints which execute lambda functions. I want to protect my api endpoints with using aws_iam as authorizer. I have a user pool with federated identities set up for this. However after implementing it into the cloudformation template I get an cors error calling it from my angular app with an authenticated user:</p>
  <pre><code>Access to XMLHttpRequest at 'api endpoint url' from origin 'http://localhost:4200' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
  </code></pre>
  <p>here is the code of my cf template:</p>
  <pre><code>create:
  handler: functions/api-create.create
  events:
    - http:
        path: get/create
        method: get
        authorizer: aws_iam
        cors: true
  </code></pre>
  <p>my lambda function looks like this:</p>
  <pre><code>export const create = async (event, context) =&gt; {
  
  
  console.log('Create: ', event)
    console.log('Context: ', context)
    const response = {
      statusCode: 200,
      headers: {
        'Access-Control-Allow-Origin': '*',
        'Access-Control-Allow-Credentials': true,
      },
      body: JSON.stringify({
        product: &quot;hallo&quot;
      }),
    };
  
  return response;
  };
  </code></pre>
  <p>Without <code>authorizer: aws_iam</code> everything works fine and I get the expected response. Does anyone know what I could be missing here.</p>