| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
- Add errorAction property to IoT event schema - Handle errorAction.lambda.functionArn in compileIoTEvents - Add unit test for errorAction functionality Fixes serverless#11642
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
Sorry, something went wrong.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 445e0e24-920c-4f8a-88f3-58c9abac9d25 📥 CommitsReviewing files that changed from the base of the PR and between 53c73fc and 902f707. 📒 Files selected for processing (2)
📝 Walkthrough WalkthroughAdded optional errorAction support to AWS IoT event schema and CloudFormation compilation: when event.iot.errorAction.lambda.functionArn is provided, the TopicRulePayload includes ErrorAction.Lambda.FunctionArn and an accompanying AWS::Lambda::Permission resource is generated. Changes
Sequence Diagram(s)sequenceDiagram
participant Dev as Developer / serverless.yml
participant SLS as Serverless Compile Plugin
participant CF as CloudFormation Template
participant IoT as AWS::IoT::TopicRule
participant Lambda as AWS::Lambda::Permission / Function
Dev->>SLS: define iot event with errorAction.lambda.functionArn
SLS->>CF: compile TopicRulePayload (include ErrorAction when present)
SLS->>CF: add AWS::Lambda::Permission resource for errorAction Lambda
CF->>IoT: create TopicRule with ErrorAction -> Lambda.FunctionArn
CF->>Lambda: attach permission allowing iot.amazonaws.com to invoke function
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem🚥 Pre-merge checks | ✅ 5 ✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches 🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. ❤️ ShareComment @coderabbitai help to get the list of available commands and usage tips. |
Sorry, something went wrong.
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agentsVerify each finding against the current code and only fix it if needed. Inline comments: In `@packages/serverless/lib/plugins/aws/package/compile/events/iot.js`: - Around line 43-62: The errorAction schema currently allows an empty object because it doesn't require any action types; update the errorAction schema (the errorAction object and its properties) to require at least one action type by adding required: ['lambda'] under the errorAction definition (so that when errorAction is present it must include the lambda property), and keep additionalProperties: false; alternatively, if you intend to support multiple action types in future, replace the properties + required approach with a oneOf pattern similar to the redrivePolicy/sns pattern so at least one action variant is enforced. - Around line 136-143: The template currently always creates TopicRulePayload.ErrorAction (event.iot.errorAction) even when no lambda is configured and it never creates a corresponding AWS::Lambda::Permission for an error-action lambda; update the logic in the compile step that builds topicRuleResource (symbols: event.iot.errorAction, topicRuleResource.Properties.TopicRulePayload.ErrorAction) so that ErrorAction is only set when event.iot.errorAction.lambda exists, and when you detect an error-action lambda generate a matching permission resource (same pattern used for the main action's AWS::Lambda::Permission resource) granting iot.amazonaws.com invoke rights to that lambda ARN (or alternatively add a schema warning if you cannot create a static/resolvable ARN); ensure the permission resource uses a unique logical ID analogous to the existing permission resource generation code.
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 9d1c6359-7a86-47a3-8f5f-86d07adb1045
📥 CommitsReviewing files that changed from the base of the PR and between 8905d7a and 53c73fc.
⛔ Files ignored due to path filters (1)
Sorry, something went wrong.
- Add required: ['lambda'] to errorAction schema to prevent empty objects - Only create ErrorAction when event.iot.errorAction.lambda exists - Generate AWS::Lambda::Permission for error-action lambda - Update tests to verify error action Lambda permission creation
| Back | FazBrowse Home | New Git URL |
Description
This PR adds support for error action configuration on AWS IoT topic rules. This allows users to specify a Lambda function that will be invoked when the IoT rule fails to execute.
Closes #11642
Changes
Usage Example
Summary by CodeRabbit
New Features
Tests