serverless: AWS SQS event Trigger for Lambdas Created as Disabled
This is a Bug Report
Description
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:
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.

If I manually toggle the status to enabled, everything works as expect
-
What went wrong? Lambda trigger event was created, but it status is disabled
-
What did you expect should have happened? Lambda trigger event was created, wiht status is enabled
-
What was the config you used? see above
-
What stacktrace or error message from your provider did you see? none
Additional Data
-
Serverless Framework Version you’re using: 1.28.0
-
Operating System: macos x
-
Stack Trace: none
-
Provider Error messages: none
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 18 (8 by maintainers)
@alexdebrie I’ve got null after run your command.
serverless --version -> 1.27.3Looked into.serverless/cloudformation-template-update-stack.jsonand no such key.upd: updated version to
1.28.0and all works as expectedThanks @alexdebrie,
it was the indentation issue. The template was not failling neither creating the event trigger, but It looks that there was an EventSourceMapping from a previuous execution. I needed to manually remove via the aws cli
aws lambda delete-event-source-mapping --uuid 3a9e218d-61be-4d1c-98a1-23f289a9bea1Kudos for implementing this feature.
@pedrodelgallego Sorry to see this. Let’s see if we can get to the bottom of this. Two follow-up questions for you:
Can you check the indentation under the
sqsevent?As you have it pasted right now, it looks like this:
When it should be like this (notice two additional spaces for the properties under
sqs):If you do have the indentation correct in your
serverless.yml, then skip to the next one.Can you print the output of the following command (will need jq installed):
cat .serverless/cloudformation-template-update-stack.json | jq ".Resources.CreateDashorderEventSourceMappingSQSDevordersqueue"It should look like this: