so i’m new to Quarkus and considering using it to deploy lambda functions to aws.
I’ve been able to create a function with GET and POST endpoints, link them to Api Gateway and hit them from postman.
However, i’m running into CORS error when i test it out from a react app.
I’ve enabled CORS on the Api gateway resource, and logs show that the request gets to the lambda, and returns my payload to api gateway, but still fails due to CORS.
I understand that for proxy integration with lambda, I need to pass the CORS headers in the response payload in addition to enabling CORS on the Api gateway.
So with Quarkus how do I achieve this?
I’ve tried to set these in the application.properties
file, but that doesn’t do anything.
Would appreciate some help with this.
Thanks
quarkus.http.cors=true
quarkus.http.cors.origins=*
quarkus.http.cors.methods=GET,PUT,POST
quarkus.http.cors.headers=x-api-key, accept, authorization, content-type
quarkus.http.cors.access-control-allow-credentials=true
Resource
@Path("/hello")
public class GreetingResource {
@GET
@Produces("application/json")
public String hello() {
return """
{
"msg": "hello"
}
""";
}
}