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

Error when registering a new mapping #2

Closed statelessness closed 8 years ago

statelessness commented 8 years ago

Hi,

First of all, thanks for this great work. I've successfully executed the deploy command with latest aws cli release. However, when I execute the following command:

./fanout register kinesis --function fanout --source-type dynamodb --source zeus-auth --id target1 --destination fanoutTest --active true

the following error is shown:

Error parsing parameter '--item': Invalid JSON: No JSON object could be decoded JSON received: {"sourceArn": {"S":"arn:aws:dynamodb:us-east-1:292326452532:table/zeus-auth/stream/2016-09-14T15:57:43.105"}, "id": {"S":"target1"}, "type": {"S":"kinesis"}, "destination": {"S":"fanoutTest"}, "active": {"BOOL":none}}

The full stacktrace, obtained enabling debug, is:

2016-09-14 18:08:43,284 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.dynamodb.put-item.table-name: calling handler <function uri_param at 0x102cb0e60> 2016-09-14 18:08:43,285 - MainThread - botocore.hooks - DEBUG - Event process-cli-arg.dynamodb.put-item: calling handler <awscli.argprocess.ParamShorthandParser object at 0x10341cc10> 2016-09-14 18:08:43,285 - MainThread - awscli.arguments - DEBUG - Unpacked value of u'fanoutTargets' for parameter "table_name": u'fanoutTargets' 2016-09-14 18:08:43,285 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.dynamodb.put-item.item: calling handler <function uri_param at 0x102cb0e60> 2016-09-14 18:08:43,285 - MainThread - botocore.hooks - DEBUG - Event process-cli-arg.dynamodb.put-item: calling handler <awscli.argprocess.ParamShorthandParser object at 0x10341cc10> 2016-09-14 18:08:43,285 - MainThread - awscli.argprocess - DEBUG - Param item looks like JSON, not considered for param shorthand. 2016-09-14 18:08:43,285 - MainThread - awscli.clidriver - DEBUG - Exception caught in main() Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/awscli/clidriver.py", line 186, in main return command_table[parsed_args.command](remaining, parsed_args) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/awscli/clidriver.py", line 381, in call return command_table[parsed_args.operation](remaining, parsed_globals) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/awscli/clidriver.py", line 522, in call parsed_args, self.arg_table) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/awscli/clidriver.py", line 578, in _build_call_parameters arg_object.add_to_params(service_params, value) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/awscli/arguments.py", line 453, in add_to_params unpacked = self._unpack_argument(value) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/awscli/arguments.py", line 470, in _unpack_argument return unpack_cli_arg(self, value) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/awscli/argprocess.py", line 166, in unpack_cli_arg cli_argument.cli_name) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/awscli/argprocess.py", line 175, in _unpack_cli_arg argument_model, value, cli_name) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/awscli/argprocess.py", line 189, in _unpack_complex_cli_arg % (e, value)) ParamError: Error parsing parameter '--item': Invalid JSON: No JSON object could be decoded JSON received: {"sourceArn": {"S":"arn:aws:dynamodb:us-east-1:292326452532:table/zeus-auth/stream/2016-09-14T15:57:43.105"}, "id": {"S":"zeus-auth-target"}, "type": {"S":"kinesis"}, "destination": {"S":"fanoutTest"}, "active": {"BOOL":none}} 2016-09-14 18:08:43,329 - MainThread - awscli.clidriver - DEBUG - Exiting with rc 255

Please, could you give me any hint?.

KR, Juan Carlos González

julienlepine commented 8 years ago

I found the issue, I'll update tomorrow as soon as I can. In the mean time, in cli/targets.sh, in function registerFanoutTarget, replace the "ACTIVE=none" line by "COLLAPSE=none", the variable names got mixed up.

statelessness commented 8 years ago

Thanks Julien for your quick response. I made the change you specified and worked fine.

julienlepine commented 8 years ago

Change pushed to master.