joostfarla / serverless-cors-plugin

Serverless CORS Plugin - Managing Cross-origin resource sharing (CORS) policies
ISC License
70 stars 15 forks source link

Internal Server Error on OPTIONS endpoint #7

Closed Borfswitch closed 8 years ago

Borfswitch commented 8 years ago

The OPTIONS endpoints that were created using the cors plugin are missing the status code in the integration request mapping template, which is resulting in this error:

                    Execution log for request test-request
Wed Jan 27 18:20:49 UTC 2016 : Starting execution for request: test-invoke-request
Wed Jan 27 18:20:49 UTC 2016 : API Key: test-invoke-api-key
Wed Jan 27 18:20:49 UTC 2016 : Method request path: {myParam=undefined}
Wed Jan 27 18:20:49 UTC 2016 : Method request query string: {}
Wed Jan 27 18:20:49 UTC 2016 : Method request headers: {}
Wed Jan 27 18:20:49 UTC 2016 : Method request body before transformations: null
Wed Jan 27 18:20:49 UTC 2016 : Execution failed due to configuration error: statusCode should be an integer which defined in request template
Wed Jan 27 18:20:49 UTC 2016 : Method completed with status: 500

To fix this, I had to manually modify the mapping template, change it from Input passthrough to mapping template, and add the following content to the template:

{"statusCode": 200}
joostfarla commented 8 years ago

Thanx for reporting! Fixed and released in v0.2.1 :)