需要在AWS Lambda中手动配置函数的输出选项,确保正确配置了函数的Handler和Role等详细信息。在代码中,这种配置通常在serverless.yml文件中进行。
代码示例:
functions: MyFunction: handler: handler.my_function role: lambda_role environment: variable1: value1 events: - http: path: my_function method: get #配置输出 #在此添加function permissions和其他具体信息 outputs: MyFunctionArn: value: !GetAtt MyFunction.Arn export: name: MyFunctionArn MyFunctionUrl: value: !Sub "https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/dev/${MyFunction}" export: name: MyFunctionUrl