sam local start-api cannot parse lambda authorizer correctly
- Dominant language
- Python
- Stars
- 6.7k
- Forks
- 1.2k
- Avg merge
- 1d 10h
- Merged PRs (30d)
- 52
Description
### Description:
Got this error when trying to test my lambda authorizer locally with `sam build` and `sam local start-api`: `Unable to parse the Lambda ARN for Authorizer 'LambdaAuthorizer', skipping`
here's my cloudformation template:
```
lambdaAuthorizer:
Type: AWS::Serverless::Function
Properties:
FunctionName: !Sub LambdaAuthorizer-${StageName}
CodeUri: lambda_authorizer/
Handler: src/handlers/authorizer.handler
Runtime: nodejs20.x
Timeout: 900
MemorySize: 512
Role: !GetAtt MyLambdaExecutionRole.Arn
Environment:
Variables:
COGNITO_USERPOOL_ID: "..."
COGNITO_CLIENT_ID: "..."
MyApi:
Type: AWS::Serverless::Api
Properties:
# StageName: dev
StageName: !Sub MyApi-${StageName}
Auth:
DefaultAuthorizer: CognitoAuthorizer
AddDefaultAuthorizerToCorsPreflight: False
Authorizers:
LambdaAuthorizer:
FunctionArn: !GetAtt lambdaAuthorizer.Arn
CognitoAuthorizer:
UserPoolArn: arn:aws:cognito-idp:us-east-1:$account_id:userpool/...
```
### Steps to reproduce:
### Observed result:
The authorizer lambda function's arn cannot be parsed, but i have followed multiple AWS docs and it seems this is the only correct way to do it
### Expected result:
I think this is quite a straightforward cloudformation and i don't understand why it cannot parse the arn
### Additional environment details (Ex: Windows, Mac, Amazon Linux etc)
1. OS: Mac
2. `sam --version`: SAM CLI, version 1.124.0
3. AWS region: us-east-1
```
{
"version": "1.124.0",
"system": {
"python": "3.8.20",
"os": "macOS-12.7.5-x86_64-i386-64bit"
},
"additional_dependencies": {
"docker_engine": "20.10.16",
"aws_cdk": "Not available",
"terraform": "1.9.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`
Contributor guide
Assessment
This issue has not been assessed yet.