Skip to main content

I have Lambda which uses API Gateway’s http-api, I have configured CORS as below…


httpApi:
cors:
allowedOrigins: "*"
allowedMethods: "*"
allowedHeaders: "*"
allowCredentials: false

I have set my response headers…


return {
statusCode: 201,
body: JSON.stringify({
publicKey: 'publicKey',
privateKey: 'privateKey',
}),
headers: {
'Content-Type': 'application/json',
'Access-Control-Allow-Origin': '*',
},
};

and yet i still get CORS errors when making the request from the Figma plugin.


The request works if set Origin: null within Postman, so to me it seems that the only solution here is to use a Proxy which I am not keen to do.


Is this a specific issue with API Gateway?

I managed to solve this issue by creating a proxy that uses API Gateway v1 Rest API that forwards all requests to API Gateway v2 HTTP API, the latter accepts wildcard origins but does not accept an origin of null, which the former does.


Reply