Calling an OPTIONS method defined with CorsIntegration returns error with status code 500.
Response body:
{
"message": "Internal server error"
}
API Gateway Logs:
Execution log for request 8eae9904-378d-4377-bff1-97a2cd11f8f7
Mon Nov 28 19:52:17 UTC 2022 : Starting execution for request: 8eae9904-378d-4377-bff1-97a2cd11f8f7
Mon Nov 28 19:52:17 UTC 2022 : HTTP Method: OPTIONS, Resource Path: /test
Mon Nov 28 19:52:17 UTC 2022 : Method request path: {}
Mon Nov 28 19:52:17 UTC 2022 : Method request query string: {}
Mon Nov 28 19:52:17 UTC 2022 : Method request headers: {content-type= application/json}
Mon Nov 28 19:52:17 UTC 2022 : Method request body before transformations:
Mon Nov 28 19:52:17 UTC 2022 : Execution failed due to configuration error: Unable to parse statusCode. It should be an integer that is defined in the request template.
Mon Nov 28 19:52:17 UTC 2022 : Method completed with status: 500
Example code:
new openapix.Api(this, "TestAPI", {
source: testApiSource,
paths: {
"/test":
post: new openapix.LambdaIntegration(this, testFunction),
options: new CorsIntegration(this, {
headers: "'Content-Type,X-Amz-Date,Authorization'",
origins: "*",
methods: "'POST, OPTIONS'",
}),
},
},
});
Calling an OPTIONS method defined with CorsIntegration returns error with status code 500.
Response body:
API Gateway Logs:
Example code: