aws-samples / aws-lambda-fanout

A sample AWS Lambda function that accepts messages from an Amazon Kinesis Stream and transfers the messages to another data transport.
Apache License 2.0
288 stars 60 forks source link

Unrecognized DynamoDB Stream arn #3

Closed statelessness closed 8 years ago

statelessness commented 8 years ago

Hi,

When configuring a mapping for a DynamoDB Stream, the lambda generates the following error:

Invalid configuration for target 'target1' of type 'kinesis', 'sourceArn' property must be a valid ARN of an Amazon Kinesis Stream or Amazon DynamoDB Stream. Ignoring target

I think that the problem is related to an erroneous regex in configuration.js file. Current value of regex is:

var sourceRegex = /^arn:aws:((kinesis:[a-z]+-[a-z]+-[0-9]:[0-9]{12}:stream\/([a-zA-Z0-9-]{1,128}))|(kinesis:[a-z]+-[a-z]+-[0-9]:[0-9]{12}:table\/[A-Za-z0-9.-]\/stream\/[0-9A-Z.:-]+))$/;_

I've replaced it with the following regex and it has worked:

var sourceRegex = /^arn:aws:((kinesis:[a-z]+-[a-z]+-[0-9]:[0-9]{12}:stream\/([a-zA-Z0-9-]{1,128}))|(dynamodb:[a-z]+-[a-z]+-[0-9]:[0-9]{12}:table\/[A-Za-z0-9.-]+\/stream\/[0-9A-Z.:-]+))$/;_

KR,

Juan Carlos González

julienlepine commented 8 years ago

Yes indeed, must have been a copy paste error in my last refactoring.

Fixed in master.