Cors enabled but continue failing

Hi.
I have an API using api gateway + lambdas (python), I have the issue of getting the No ‘Access-Control-Allow-Origin’ header is present on the requested resource.
In my yml file i already have enabled cors and added the headers to the response of the lambda function but I’m still getting the same error, I don’t know what else needs to be done

Here is the example of my function definition in the yml file and the response headers of the lambda

function_name:
handler: handler.function_name 
events:
        - http:
            path: function-name
            method: any
            private: true
            cors: true

and the lambda response

response = {
    "headers": {
       'Access-Control-Allow-Headers': 'Content-Type',
       "Content-Type": "application/json",
       "Access-Control-Allow-Origin": "*"
       },
    "statusCode": 200,
    "body": json.dumps(answer, indent=4, sort_keys=True, default=str)
}

I don’t know what else is missing as I’ve followed the examples here: https://www.serverless.com/framework/docs/providers/aws/events/apigateway/#enabling-cors

Any help is really appreciated.