I’m trying to create an SNS topic in my serverless.yml Resources then reference it in my Lambda’s “onError” to use it as a DeadLetterQueue. I can create the topic and reference it in the iamRoleStatements fine. But when I try to use a CloudFormation “Ref” in the Lambda onError, I get a complaint “onError config must be provided as a string”.
That comes from the SLS code: https://github.com/serverless/serverless/pull/3609/files
Is this due to restrictions in CloudFormation itself, so there’s no way SLS can implement it?The AWS docs imply only a string is possible, not a Ref:
Am I understanding this limitation correctly?
gmetzker created a plugin and I’m guessing it’s to get-around this limitation, is that correct?
My most minimal example code:
service: dlqtest provider: name: aws runtime: python3.6 iamRoleStatements: - Effect: Allow Action: - "sns:Publish" Resource: Ref: DeadLetterQueue resources: Resources: DeadLetterQueue: Type: AWS::SNS::Topic Properties: Subscription: - Endpoint: email@example.com Protocol: email functions: DlqTest: handler: dlqtest.handler onError: arn:aws:sns:us-east-1:########:dlqtest-dev-DeadLetterQueue-14HOO3X2AAUX7 # Ref: DeadLetterQueue # doesn't work: "onError config must be provided as a string" events: - s3: bucket: cshenton-dlqtest event: s3:ObjectCreated:*