<#C01JG3B20RY|help> Can someone help me. I have be...
# help
k
#help Can someone help me. I have been struggling for days. i am having cors issues. I have enabled cors but still getting a cors error
t
can you share more about the cors error
and your api setup
k
@thdxr
Copy code
export function MyStack({ stack }: StackContext) {
  const api = new Api(stack, "api", {
    routes: {
      "GET /test": {
        authorizer: "none",
        function: "functions/lambda.handler"
      },
    },
    cors: {
      allowOrigins: ["<http://localhost:3000>"],
      allowMethods: ["GET", "DELETE", "PUT", "POST", "PATCH", "OPTIONS"],
      allowHeaders: ["Access-Control-Allow-Headers", "Origin", "Accept", "X-Requested-With", "Content-Type",
        "Access-Control-Request-Method", "Access-Control-Request-Headers"],
      allowCredentials: true
    },
  });

  stack.addOutputs({
    ApiEndpoint: api.url,
  });
}
https://tnlcc4ff98.execute-api.us-east-1.amazonaws.com This is the end point i am hitting as a result. Using postman/browser i am able to get results, but through nextjs i am unable to
Hi, @thdxr thanks I appreciate the help. After so many tries I saw that 8 missed headers on both set and frontend