New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allows Fn::GetAtt with Lambda DLQ-onError #5139

Merged
merged 2 commits into from Jan 28, 2019

Conversation

Projects
7 participants
@martinjlowm
Copy link
Contributor

martinjlowm commented Jul 20, 2018

What did you implement:

Arn references for SQS queues are now available using:

Fn::GetAtt:
  - Queue
  - Arn

How did you implement it:

According to https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-sqs-queues.html#aws-properties-sqs-queues-ref an SQS reference returns its URL which is not sufficient for Lambda DLQ config which requires an ARN.

isArnRefOrImportValue is renamed to isArnRefGetAttOrImportValue and extended to also look for Fn::GetAtt.

How can we verify it:

Write a minimal Serverless setup that mimics that of the new test: 'should create necessary resources if a Fn::GetAtt is provided'.

Todos:

  • Write tests
  • Write documentation
  • Fix linting errors
  • Make sure code coverage hasn't dropped
  • Provide verification config / commands / resources
  • Enable "Allow edits from maintainers" for this PR
  • Update the messages below

Is this ready for review?: Yes
Is it a breaking change?: NO

Allows Fn::GetAtt with Lambda DLQ-onError
Arn references for SQS queues are now available using:

```
Fn::GetAtt:
  - Queue
  - Arn
```
@vKongv

This comment has been minimized.

Copy link

vKongv commented Aug 27, 2018

Does this solve the race condition mentioned in the doc? https://serverless.com/framework/docs/providers/aws/guide/functions#dlq-with-sqs

@martinjlowm

This comment has been minimized.

Copy link
Contributor Author

martinjlowm commented Aug 29, 2018

I'm not sure. I haven't experienced the race condition myself with this patch and I have done a couple of fresh re-deployments.

@lglapinski

This comment has been minimized.

Copy link

lglapinski commented Oct 8, 2018

Can we expect any review in near future?

@bayoudhi

This comment has been minimized.

Copy link

bayoudhi commented Nov 4, 2018

Can we expect any review in near future please !!!

@pmuens pmuens self-assigned this Jan 25, 2019

@pmuens pmuens added this to In progress in Serverless via automation Jan 25, 2019

@pmuens

pmuens approved these changes Jan 28, 2019

Copy link
Member

pmuens left a comment

Thanks for working on this @martinjlowm 👍

Just tested it with the following configuration:

service: test # NOTE: update this with your service name

provider:
  name: aws
  runtime: nodejs8.10
  iamRoleStatements:
  - Effect: Allow
    Action:
      - sqs:SendMessage
      - sqs:DeleteMessage
      - sqs:ReceiveMessage
    Resource: arn:aws:sqs:*:*:SampleQueue

functions:
  hello:
    handler: handler.hello
    onError:
      Fn::GetAtt:
        - MyQueue
        - Arn

resources:
  Resources:
    MyQueue:
      Type: AWS::SQS::Queue
      Properties:
        QueueName: SampleQueue

Works like expected 👍

Just pushed another minor doc update. Will merge once the build is green :shipit:

Serverless automation moved this from In progress to Reviewer approved Jan 28, 2019

@pmuens pmuens merged commit 4ae0ff1 into serverless:master Jan 28, 2019

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

Serverless automation moved this from Reviewer approved to Done Jan 28, 2019

@pmuens pmuens added this to the 1.36.4 milestone Feb 5, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment