Skip to content

Valid paths not matched from serverless.yml #16

Description

@DanRVP

With a HttpAPI definition like so:

functions:
    my_function:
        name: my-function
        handler: handler.php
        description: ''
        runtime: php-83
        events:
            - httpApi: 'ANY /{param}'

The error 404 - Route '/myroute' not found in serverless.yml is returned.

This issue lies in Router::fromServerlessConfig() and Router::matchesMethod().

  1. fromServerlessConfig only does extra parsing on array definitions via patternToString. In this case only a lower-case any is converted to *. Uppercase ANY is always skipped. No extra checks are done on strings.
  2. matchesMethod will only look for *, assuming that the upstream call to fromServerlessConfig has correctly parsed and converted ANY to a wildcard.

In both cases a valid API gateway definition is skipped.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions