Skip to content

Authorizers don't work with explicit ServerlessRestApi API resource #1108

@keetonian

Description

@keetonian

Description:

Authorizers (at least default auth) does not work as expected when ServerlessRestApi is used as the name for a Serverless::Api.

This requires a deeper dive into how using the name ServerlessRestApi can affect SAM features. This is the name SAM uses for the implicit API, but this should behave the same as any other name if a customer doesn't use the implicit API.

You can avoid this bug in the meantime by not using the ServerlessRestApi name.

Steps to reproduce the issue:

  1. Check out https://github.com/awslabs/serverless-application-model/blob/master/examples/2016-10-31/api_lambda_token_auth/template.yaml
  2. Run bin/sam-translate.py on the file after changing MyApi to ServerlessRestApi
  3. View transformed file

Observed result:
No auth is configured on paths

Expected result:
Auth should be configured on all of the paths.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions