# AWS SQS event Trigger for Lambdas Created as Disabled

**URL:** <https://forum.serverless.com/t/aws-sqs-event-trigger-for-lambdas-created-as-disabled/4988>\
**Category:** Serverless Framework\
**Created:** [July 5, 2018, 10:47pm UTC](https://forum.serverless.com/t/aws-sqs-event-trigger-for-lambdas-created-as-disabled/4988 "2018-07-05T22:47:12Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![pgallego](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/pgallego/32/2184_2.png) [@pgallego](https://forum.serverless.com/u/pgallego)\
**Post date:** [July 5, 2018, 10:47pm UTC](https://forum.serverless.com/t/aws-sqs-event-trigger-for-lambdas-created-as-disabled/4988/1 "2018-07-05T22:47:12Z")

</div>

Hi,

I am testing the new SQS trigger, the creation of the queue and the lambda works well, but the status of the trigger is disabled. This is how my yml looks like:

```auto
service:
  name: kopi-orders-api

plugins:
  - serverless-webpack
  - serverless-pseudo-parameters

provider:
  name: aws
  runtime: nodejs8.10
  region: eu-west-1
  stage: ${opt:stage, 'dev'}
  iamRoleStatements:
  - Effect: Allow
    Action:
      - sqs:*
    Resource: arn:aws:sqs:*:*:*
  - Effect: Allow
    Action:
      - sqs:ListQueues
    Resource: "*"

custom:
  ordersQueueName: ${self:provider.stage}-orders-queue

resources:
  Resources:
    ordersQueue:
      Type: "AWS::SQS::Queue"
      Properties:
        QueueName: ${self:custom.ordersQueueName}

functions:
  create-order:
    handler: orders/create.create
    events:
      - sqs:
        arn: arn:aws:sqs:#{AWS::Region}:#{AWS::AccountId}:${self:custom.ordersQueueName}
        batchSize: 1
        enabled: true

```

And this is how it looks like in the aws console right after the creation.

 ![16](https://canada1.discourse-cdn.com/flex036/uploads/serverless/original/2X/a/a0fcef0a7115a88a061607be21c97b095f218868.png)

If I manually toggle the status to enabled, everything works as expect

Any suggestion on what I am missing?

---

<div class="post-metadata">

**Author:** ![jeremydaly](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/jeremydaly/32/2104_2.png) [@jeremydaly](https://forum.serverless.com/u/jeremydaly)\
**Post date:** [July 7, 2018, 1:14pm UTC](https://forum.serverless.com/t/aws-sqs-event-trigger-for-lambdas-created-as-disabled/4988/2 "2018-07-07T13:14:30Z")

</div>

I tried your exact configuration and I didn’t have any problems. If you can switch it on in the console, then it shouldn’t be a permissions error.

Have you tried deploying without including the `enabled: true` line in the event config? It is enabled by default.

---

<div class="post-metadata">

**Author:** ![pgallego](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/pgallego/32/2184_2.png) [@pgallego](https://forum.serverless.com/u/pgallego)\
**Post date:** [July 7, 2018, 1:29pm UTC](https://forum.serverless.com/t/aws-sqs-event-trigger-for-lambdas-created-as-disabled/4988/3 "2018-07-07T13:29:00Z")

</div>

Hi @jeremydaly

I got it working. the issue was the indentation in the SQS event. it was

```auto
functions:
  create-order:
    handler: orders/create.create
    events:
      - sqs:
        arn: arn:aws:sqs:#{AWS::Region}:#{AWS::AccountId}:${self:custom.ordersQueueName}
        batchSize: 1
        enabled: true

```

But it should have been

```auto
functions:
  create-order:
    handler: orders/create.create
    events:
      - sqs:
          arn: arn:aws:sqs:#{AWS::Region}:#{AWS::AccountId}:${self:custom.ordersQueueName}
          batchSize: 1
          enabled: true

```

The template was not failling neither creating the event trigger, but It looks that there was an EventSourceMapping from a previuous execution. so I needed to manually remove via the aws cli aws lambda delete-event-source-mapping --uuid 3a9e218d-61be-4d1c-98a1-23f289a9bea1

Thanks for taking a look.

---

<div class="post-metadata">

**Author:** ![jeremydaly](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/jeremydaly/32/2104_2.png) [@jeremydaly](https://forum.serverless.com/u/jeremydaly)\
**Post date:** [July 7, 2018, 6:00pm UTC](https://forum.serverless.com/t/aws-sqs-event-trigger-for-lambdas-created-as-disabled/4988/4 "2018-07-07T18:00:04Z")

</div>

Indentation errors 🤦🏻‍♂️

Glad you got it working!
