Skip to content
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

Add functionResponseTypes sqs #10265

Merged
merged 4 commits into from Nov 24, 2021

Conversation

nicoeft
Copy link
Contributor

@nicoeft nicoeft commented Nov 24, 2021

Added functionResponseTypes property support to SQS event source mapping so 'ReportBatchItemFailures' can be set.

  • compile/events/sqs.js now handles functionResponseTypes property.
  • compile/events/sqs.test.js new test to prove feature works as intended.
  • Update in aws/events/sqs.md

Copy link
Contributor

@medikoo medikoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nicoeft great thanks for fast action on that! In general it looks very good. I have just few suggestions

@@ -22,6 +22,7 @@ class AwsCompileSQSEvents {
batchSize: { type: 'integer', minimum: 1, maximum: 10000 },
enabled: { type: 'boolean' },
maximumBatchingWindow: { type: 'integer', minimum: 0, maximum: 300 },
functionResponseTypes: { enum: ['ReportBatchItemFailures'] },
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be functionResponseType (as in case of stream event)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect thanks

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just checked the CloudFormation docs and it's actually plural + an array there: https://docs.aws.amazon.com/fr_fr/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-eventsourcemapping.html#cfn-lambda-eventsourcemapping-functionresponsetypes

image

Since all (most?) properties in Serverless Framework are 1:1 mapping with CloudFormation, we should probably reflect that here too?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AWS quite often uses plural names while supporting only singular input (in form of array with single item)

In Framework, in most cases, we work then with singular names. Here we accept a string, and not an array of strings, hence singular form. Also, it reflects 1:1 how we handle this property in other stream events:

functionResponseType: { enum: ['ReportBatchItemFailures'] },

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK that sounds good to me, as long as we use the singular form (which seems to be the case here).

That way if we ever need to support the plural form we can.

docs/providers/aws/events/sqs.md Outdated Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Nov 24, 2021

Codecov Report

Merging #10265 (02172e2) into master (ce66591) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master   #10265   +/-   ##
=======================================
  Coverage   85.39%   85.39%           
=======================================
  Files         339      339           
  Lines       13840    13842    +2     
=======================================
+ Hits        11819    11821    +2     
  Misses       2021     2021           
Impacted Files Coverage Δ
lib/plugins/aws/package/compile/events/sqs.js 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ce66591...02172e2. Read the comment docs.

@nicoeft nicoeft requested a review from medikoo November 24, 2021 11:32
Copy link
Contributor

@medikoo medikoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @nicoeft, that looks great to me 👍

@mnapoli WDYT? Do you have any more suggestions?

Copy link
Contributor

@mnapoli mnapoli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding approval on the feature design + documentation part, I'll let others review the implementation.

@mnapoli
Copy link
Contributor

mnapoli commented Nov 24, 2021

Ah @medikoo all good for me ^^

@nicoeft
Copy link
Contributor Author

nicoeft commented Nov 24, 2021

Great, thank you guys!

@medikoo medikoo merged commit 44511f3 into serverless:master Nov 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants