serverless-aws-alias
serverless-aws-alias copied to clipboard
SQS Queues
We are using serverless 1.28 to setup lambda triggers. https://serverless.com/framework/docs/providers/aws/events/sqs/
Without the serverless-aws-alias plugin, this functionality works correctly. With it, we run into some really odd problems where all functions are subscribed to one of the SQS queues.
I tracked the issue down to this code: https://github.com/HyperBrain/serverless-aws-alias/blob/master/lib/stackops/events.js#L34-L40 - it ends up with an undefined resourceRefName.
A subscription the code is looking at looks something like the following (from cloudformation-template-update-stack.json):
"ProcessCardTransactionEventSourceMappingSQSCardtransactions": {
"Type": "AWS::Lambda::EventSourceMapping",
"DependsOn": "IamRoleLambdaExecution",
"Properties": {
"BatchSize": 1,
"EventSourceArn": "arn:aws:sqs:us-east-1:123456789:card-transactions",
"FunctionName": {
"Fn::GetAtt": [
"ProcessCardTransactionLambdaFunction",
"Arn"
]
},
"Enabled": "True"
}
},
Here is a snippet from my serverless.yml
functions:
processCardTransaction:
handler: dist/handlers/cardTransactions
timeout: 30
reservedConcurrency: 1
events:
- sqs:
arn: "arn:aws:sqs:us-east-1:123456789:card-transactions"
batchSize: 1
enabled: true
processBankTransaction:
handler: dist/handlers/bankTransactions
timeout: 30
reservedConcurrency: 1
events:
- sqs:
arn: "arn:aws:sqs:us-east-1:123456789:bank-transactions"
batchSize: 1
enabled: true
Any help here would be appreciated.
Thanks!
have you found some solution to this problem? at least some temporary workaround?
I didn’t. I actually ended up punting on setting up event source mappings with serverless. Instead we use serverless to manage lambda infrastructure and terraform to manage the rest. I was skeptical having it split but it works really well.
Using something like terraform is likely inevitable given the number of things serverless doesn’t support.