Skip to content

Feature request: Documented Example of Local Authorizer Usage #5172

Open

Description

@ChronosMasterOfAllTime

Describe your idea/feature/enhancement

@lucashuy love the new feature for local authorizers in 1.80.0+, can we get documentation or a working example of how to set up an authorizer with sam local start-api?

Proposal

Add a sample local_authorizer_template.yml or LOCAL_AUTHORIZER_EXAMPLE.md file that bootstraps the authorizer correctly

Things to consider:

  1. Will this require any updates to the SAM Spec - No

Additional Details

Please provide documentation and examples on how to use a local Authorizer defined within the template.

Activity

  1. added
    stage/needs-triage
    type/feature
    on May 15, 2023
  2. sriram-mv commented on May 16, 2023

    @sriram-mv
    Contributor
  3. added and removed
    type/feature
    stage/needs-triage
    on May 16, 2023
  4. ChronosMasterOfAllTime commented on May 25, 2023

    @ChronosMasterOfAllTime
    Author

    sam local docs opens up this page: https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-using-start-api.html

    We will add this as an area for us to look into.

    Thanks, I am talking about the new feature introduced in 1.80+ to use local authorizer for testing. How do you define the authorizer differently as FunctionArn is not the way to go as SAM local doesnt support !GetAtt?

    I am looking for examples of how to rope in our Authorizer for local testing.

  5. brandon-burciaga commented on Jun 14, 2023

    @brandon-burciaga

    I am also looking to know this. I keep getting messages about skip parsing unsupported authorizer. I also was trying to use !GetAtt

    @ChronosMasterOfAllTime did you figure this out?

  6. ChronosMasterOfAllTime commented on Jun 15, 2023

    @ChronosMasterOfAllTime
    Author

    I am also looking to know this. I keep getting messages about skip parsing unsupported authorizer. I also was trying to use !GetAtt

    @ChronosMasterOfAllTime did you figure this out?

    If you start with the --debug flag you will see !GetAtt is not a supported function. From what I gathered you need to define the authorizer as a parameter and override the reference for local. Not ideal IMHO. We ended up pulling out the authorizer from API gateway and chaining it as part of the handler proxy middlewares. (We're using golang chi router plus the serverless proxy).

    Hopefully someone gets this documented with a working example!

  7. Willis0826 commented on Aug 6, 2023

    @Willis0826

    Hey, after I traced the source code and followed your findings, I managed to make it works!
    Here is a demo : https://github.com/Willis0826/sam-local-authorizer-example
    Please feel free to take a look, cheers!

  8. kPOWz commented on Apr 1, 2024

    @kPOWz

    Does the feature (released in 1.80.0) work with SAM local for CDK ? https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-cdk-testing.html

    I'm using the basic "AWS::ApiGatewayV2::Authorizer", "AuthorizerType": "JWT", and not seeing any auth happen on the latest version of SAM CLI

  9. lukacssandor commented on Nov 19, 2025

    @lukacssandor

    My workaround for now is to manually construct the authorizer's ARN when specifying it on the Api.
    Example here: #7483 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions