2

我对无服务器很陌生,我正在尝试从无服务器 yaml 文件为 Cognito 设置自定义挑战。我有以下功能

functions: t-challenge-define: handler: t-auth-challenge.define t-challenge-create: handler: t-auth-challenge.create t-challenge-response: handler: t-auth-challenge.verifyResponse resources: Resources: CognitoUserPool: Type: AWS::Cognito::UserPool Properties: UserPoolName: my_user_pool_name MfaConfiguration: "OFF" UsernameAttributes: - phone_number Schema: - Name: phone_number AttributeDataType: String Mutable: false Required: true - Name: locale AttributeDataType: String Mutable: true Required: true LambdaConfig: DefineAuthChallenge: (how do i reference func here)

4

2 回答 2

4
LambdaConfig:
      DefineAuthChallenge:
        Fn::GetAtt: [ T-challenge-defineLambdaFunction, Arn ]
      CreateAuthChallenge:
        Fn::GetAtt: [ T-challenge-createLambdaFunction, Arn ]
      VerifyAuthChallengeResponse:
        Fn::GetAtt: [ T-challenge-responseLambdaFunction, Arn ]

您还可以利用 GetAtt CloudFormation 函数为您的 lambda 函数获取准确的 ARN。

于 2018-06-30T08:04:57.217 回答
3
LambdaConfig:
 DefineAuthChallenge: "arn:aws:lambda:${self:custom.region}:${self:custom.accountId}:function:t-challenge-define"

您需要添加具有上述特定格式的 arn。

于 2018-06-01T03:56:23.157 回答