-
Are you certain it's a bug?
Is the issue caused by a plugin?
Are you using the latest v3 release?
Is there an existing issue for this?
Issue descriptionschema validator reports that lambda events DynamoDB stream filterPatterns must be an array which I think is not correct as when filterPatterns is an array the filter must match one of patterns but when it is an object it must match each pattern example with an array: functions:
myLambda:
handler: src/handlers/myLambda.default
events:
- stream:
arn: arn:aws:dynamodb:region:XXXXXX:table/Test/stream/1970-01-01T00:00:00.000
batchSize: 5
filterPatterns:
- eventName: INSERT
- dynamodb:
NewImage:
Type:
S: [Invoice] in this case if eventName == "INSERT" OR record's (item).Type == "Invoice" the record is accepted example with a key-value object: functions:
myLambda:
handler: src/handlers/myLambda.default
events:
- stream:
arn: arn:aws:dynamodb:region:XXXXXX:table/Test/stream/1970-01-01T00:00:00.000
batchSize: 5
filterPatterns:
eventName: INSERT
dynamodb:
NewImage:
Type:
S: [Invoice] in this case if eventName == "INSERT" AND record's (item).Type == "Invoice" then the record is accepted maybe I'm wrong and there's already another method to declare "AND" type filters ? Service configuration (serverless.yml) contentservice: sls-project
frameworkVersion: "3"
package:
individually: true
provider:
name: aws
runtime: nodejs18.x
versionFunctions: false
region: eu-west-3
deploymentMethod: direct
functions:
myLambda:
handler: src/handlers/myLambda.default
events:
- stream:
arn: arn:aws:dynamodb:region:XXXXXX:table/Test/stream/1970-01-01T00:00:00.000
batchSize: 5
filterPatterns:
eventName: INSERT
dynamodb:
NewImage:
Type:
S: [Invoice] Command name and used flagsany sls command Command outputWarning: Invalid configuration encountered
at 'functions.myLambda.events.0.stream.filterPatterns': must be array
Learn more about configuration validation here: http://slss.io/configuration-validation Environment informationRunning "serverless" from node_modules
Framework Core: 3.26.0 (local) 3.26.0 (global)
Plugin: 6.2.2
SDK: 4.3.2 |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
I think
Instead of this, please try to use something like this:
|
Beta Was this translation helpful? Give feedback.
I think
filterPaterns
structure is wrong.Instead of this, please try to use something like this: