没有创建无服务器SQS Lambda触发器

时间:2019-11-17 17:51:31

标签: amazon-web-services aws-lambda amazon-sqs serverless

我有一个简单的无服务器项目,我试图在其中触发SQS事件的lambda。创建了队列,但是没有创建Lambda触发器。当我在AWS控制台中选择Queue时,Lambda Triggers选项卡为空。关于可能发生的事情有什么想法吗?

serverless.yml

service: sqs-test-trigger

provider:
  name: aws
  runtime: nodejs10.x

functions:
  receiver:
    handler: receiver.handler
    events:
      - sqs:
          arn:
            Fn::GetAtt:
              - TestSQS
              - Arn
resources:
  Resources:
    TestSQS:
      Type: "AWS::SQS::Queue"
      Properties:
        QueueName: "TestSQS"

我的处理程序(receiver.js):

exports.handler = (event, context, callback) => {
  const response = {
      statusCode: 200,
      body: JSON.stringify({
          message: "SQS event processed.",
          input: event,
      }),
  };
  console.info("event:", JSON.stringify(event));
  callback(null, response);
};

0 个答案:

没有答案