You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Feature request: Documented Example of Local Authorizer Usage #5172
@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:
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.
Reacted by Brandon Burciaga and Sai Phaninder Reddy Jonnala
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.
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!
Activity
sriram-mv commentedon May 16, 2023
sam local docsopens up this page: https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-using-start-api.htmlWe will add this as an area for us to look into.
ChronosMasterOfAllTime commentedon May 25, 2023
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.
brandon-burciaga commentedon Jun 14, 2023
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?
ChronosMasterOfAllTime commentedon Jun 15, 2023
If you start with the
--debugflag 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!
Willis0826 commentedon Aug 6, 2023
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!
kPOWz commentedon Apr 1, 2024
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
lukacssandor commentedon Nov 19, 2025
My workaround for now is to manually construct the authorizer's ARN when specifying it on the Api.
Example here: #7483 (comment)