I am using serverless to deploy my service. This is how i am configuring a lambda function
hello:
handler: handler.hello
events:
- http:
path: /hello
method: get
cors: true
authorizer: aws_iam
Also i am using AWS cognito to authorise logged in user. The same user credentials are working for other serverless services but for this one. we are sending proper response headers as well as mentioned in some other solutions. I have tried almost everything i could find.
This is the error i am getting (Though option call is giving 200).
Access to fetch at 'https://*******.execute-api.us-east-2.amazonaws.com/dev/hello' from origin 'http://***.ngrok.io' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
I would appreciate your help. Please comment if any other information is required for you to understand my problem.
Thanks a lot.