gmetzker / serverless-plugin-lambda-dead-letter

serverless plugin that can configure a lambda with a dead letter queue or topic
MIT License
46 stars 15 forks source link

Can't work with documented syntax #37

Closed kalinchernev closed 6 years ago

kalinchernev commented 6 years ago

Relates to #32

In service A, I got the resource created successfully on deployment:

resources:
  Resources:
    LambdaFailureQueue:
      Type: AWS::SQS::Queue
      Properties:
        QueueName: ${self:provider.stage}-${self:service}
        MessageRetentionPeriod: '1209600'
        VisibilityTimeout: '60'

and a handler in the same serverless.yml file successfully gets triggered by

    events:
      - sqs:
          arn:
            Fn::GetAtt:
              - LambdaFailureQueue
              - Arn

So far, so good. Then, in service B, I'm trying to attach fallback behavior to this previously created dead letter queue.

These don't work:

    deadLetter:
      targetArn:
        - 'Fn::Join':
          - ':'
          -
            - 'arn:aws:sqs'
            - Ref: 'AWS::Region'
            - Ref: 'AWS::AccountId'
            - '${self:provider.stage}-ingestion-dead-letter-queue'

Results in:

Function property parseCsv.deadLetter.targetArn object is missing GetResourceArn property.
    deadLetter:
      targetArn:
        GetResourceArn:
          - 'Fn::Join':
            - ':'
            -
              - 'arn:aws:sqs'
              - Ref: 'AWS::Region'
              - Ref: 'AWS::AccountId'
              - '${self:provider.stage}-ingestion-dead-letter-queue'

Results in

Expected params.LogicalResourceId to be a string

The only syntax, which works is the following:

    deadLetter:
      targetArn: 'arn:aws:sqs:${self:provider.region}:12345:${self:provider.stage}-ingestion-dead-letter-queue'

I've tried using serverless-pseudo-parameters in order to have the following syntax:

    deadLetter:
      targetArn: 'arn:aws:sqs:${self:provider.region}:#{AWS::AccountId}:${self:provider.stage}-ingestion-dead-letter-queue'

However, this results in

Function property parseCsv.deadLetter.targetArn object is missing GetResourceArn property.

Another approach I tried:

Make an export from service A:

  Outputs:
    LambdaFailureQueue:
      Description: The dead letter queue for AWS Lambda handlers.
      Value:
        Fn::GetAtt: ["LambdaFailureQueue", "Arn"]
      Export:
        Name: "${self:custom.eubfrEnvironment}:${self:service}:LambdaFailureQueue"

And then try an import in service B:

    deadLetter:
      targetArn:
        Fn::ImportValue: ${self:custom.eubfrEnvironment}:ingestion-dead-letter-queue:LambdaFailureQueue

-> not working

Function property parseCsv.deadLetter.targetArn object is missing GetResourceArn property.

trying also

    deadLetter:
      targetArn:
        GetResourceArn:
          Fn::ImportValue: ${self:custom.eubfrEnvironment}:ingestion-dead-letter-queue:LambdaFailureQueue

-> again error

Expected params.LogicalResourceId to be a string

My goal is to find a way to get rid of the specific account number, as a wildcard also results in:

Function property parseCsv.deadLetter.targetArn = 'arn:aws:sqs:eu-central-1:*:chernka204-ingestion-dead-letter-queue'.  This is not a valid sns or sqs arn. 
kalinchernev commented 6 years ago

This solution worked quite well as a workaround.

arielb135 commented 3 years ago

This is still not working.. can't understand why it's closed and not fixed