Skip to content

OPTIONS requests passed to Function #195

@jandusek

Description

@jandusek

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions