aws-sam-cli
aws-sam-cli copied to clipboard
Feature request: Documented Example of Local Authorizer Usage
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:
- 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.
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.
sam local docs
opens 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.
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.
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?
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!
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!
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