-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Labels
area/local/start-apisam local start-api commandsam local start-api command
Description
Description:
I know using a local authorizer was released in I think version 1.80.0, which is great. However, I want to be able to use an already deployed authorizer while running sam local start-api. This authorizer is in it's own repo and is brought into other SAM repos like this, using it's ARN:
Example template:
Resources:
BaseApi:
Type: AWS::Serverless::Api
Properties:
Auth:
DefaultAuthorizer: MyAuth
AddDefaultAuthorizerToCorsPreflight: false
Authorizers:
MyAuth:
FunctionPayloadType: REQUEST
FunctionArn: !Sub 'arn:aws:lambda:us-east-1:123123123123:function:my-jwt-authorizer-${Env}'
Identity:
ReauthorizeEvery: 0
This does not work, and the error output can be seen below.
Steps to reproduce:
- Deploy an authorizer to AWS in it's own repository
- Attempt to use that authorizer in another repo
template.ymlby using it's FunctionARN. - Run
sam local start-api - Call a function
- See the error output above
Observed result:
sam my-jwt-authorizer-dev not found. Possible options in your template: [...]
sam Failed to find a Function to invoke a Lambda authorizer, verify that this Function exists locally if it is not a remote resource. sam | Lambda authorizer failed to invoke successfully: FunctionNotFound
Expected result:
The deployed authorizer to be referenced correctly by it's ARN and ran before running the local Lambda function.
Additional environment details (Ex: Windows, Mac, Amazon Linux etc)
- OS:
sam --version:- AWS region:
# Paste the output of `sam --info` here
"version": "1.86.1",
"system": {
"python": "3.11.3",
"os": "Linux-5.10.16.3-microsoft-standard-WSL2-x86_64-with-glibc2.31" }, "additional_dependencies": { "docker_engine": "23.0.3", "aws_cdk": "2.69.0 (build 60a5b2a)", "terraform": "1.3.3" }, "available_beta_feature_env_vars": [ "SAM_CLI_BETA_FEATURES", "SAM_CLI_BETA_BUILD_PERFORMANCE", "SAM_CLI_BETA_TERRAFORM_SUPPORT", "SAM_CLI_BETA_RUST_CARGO_LAMBDA" ] }
Add --debug flag to command you are running
Metadata
Metadata
Assignees
Labels
area/local/start-apisam local start-api commandsam local start-api command