本地运行AWS Lambda API时遭遇Missing Authentication Token错误求助
问题
使用sam local start-api本地运行Lambda API时,原本不需要认证令牌的请求却收到错误{"message":"Missing Authentication Token"}。
代码
我在CloudFormation模板中创建了Lambda函数和对应的API Gateway,因为用start-api本地运行时会失败,所以添加了如下Events配置:
MyApi: Type: AWS::Serverless::Function Properties: CodeUri: myapi Handler: lambda_handler.lambda_handler Runtime: python3.10 Architectures: - arm64 ... Events: Any: Type: HttpApi Properties: Path: '/myapi/*' Method: any
复现步骤
- 执行
sam build && sam local start-api启动API - 执行
curl localhost:8080/myapi/ping- 8080已在samconfig中配置
/myapi/ping已在API Gateway和lambda_handler中配置
内容的提问来源于stack exchange,提问作者DarkTrick
相关产品推荐
相关产品推荐

