【问题标题】:Error testing step function locally: The security token included in the request is invalid本地测试step函数报错:请求中包含的安全令牌无效
【发布时间】:2021-10-12 07:50:44
【问题描述】:

我正在尝试在本地测试阶跃函数。我已经定义了我的 stateMachine.json 并使用 aws configure 添加了我的凭据(aws_access_key_idaws_secret_access_key)。

我正在按照以下步骤运行状态机:https://docs.aws.amazon.com/step-functions/latest/dg/sfn-local-lambda.html。但是当我开始执行时,我得到了这个错误:

2021-08-08 05:37:56.464: arn:aws:states:us-east-1:123456789012:execution:StateMachine:firstTest : {"Type":"LambdaFunctionFailed","PreviousEventId":4,"LambdaFunctionFailedEventDetails":{"Error":"Lambda.AWSLambdaException","Cause":"The security token included in the request is invalid. (Service: AWSLambda; Status Code: 403; Error Code: UnrecognizedClientException; Request ID: 66622740-bcbc-4397-8c97-75454dca550d; Proxy: null)"}}

可能是哪个错误?

【问题讨论】:

    标签: amazon-web-services aws-step-functions aws-sam


    【解决方案1】:

    需要将环境变量LAMBDA_ENDPOINT设置为host.docker.internal


    Step 3,您运行以下命令:

    sam local start-lambda
    

    输出如下:

    ...
    * Running on http://127.0.0.1:3001/ (Press CTRL+C to quit)
    

    记住3001,下面会用到。

    然后,参考Step Functions Local configuration options。 它说,aws-stepfunctions-local-credentials.txt 包含凭据。

    包括LAMBDA_ENDPOINT=http://host.docker.internal:3001

    凭证文件示例:

    AWS_ACCOUNT_ID= ...
    AWS_DEFAULT_REGION= ...
    AWS_ACCESS_KEY_ID= ...
    AWS_SECRET_ACCESS_KEY= ...
    LAMBDA_ENDPOINT=http://host.docker.internal:3001
    

    【讨论】:

      猜你喜欢
      • 2021-12-12
      • 1970-01-01
      • 2016-12-12
      • 2018-04-09
      • 2015-02-20
      • 1970-01-01
      • 2019-04-20
      • 2021-06-22
      • 1970-01-01
      相关资源
      最近更新 更多