You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

本地运行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

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.27 01:33:10