-
Couldn't load subscription status.
- Fork 64
Description
Issue
When a Function is deployed in Twilio's serverless environment, OPTIONS requests seem to get automatically acknowledged and do not get passed to the function itself.
However when running a function locally with twilio serverless:start, OPTIONS requests do get passed to the function itself.
Can the local function behave the same way the deployed function does?
Why this matters?
When developing functions as backend to e.g. Flex plugins, if the plugin initiates a POST CORS request with some params (that the function expects), the fact that the request is CORS will enforce an initial OPTIONS request with an empty body. This will invoke the function with an empty event object, which will typically result in the function failing (since it expects some params).
And since functions don't provide any mechanism to detect the type of request used, it's not even possible to design a workaround that would manually ack all OPTIONS requests when running the function locally.