rackerlabs / lambda-uploader

Helps package and upload Python lambda functions to AWS
Apache License 2.0
270 stars 56 forks source link

KeyError: 'starting_position' in config.py:155 when running without arguments #151

Open butla opened 6 years ago

butla commented 6 years ago

I've never used lambda-uploader before, but I decided to give it a go, because I'm starting with AWS Lambda. So I put some python code in the project's directory, added lambda.json (content below), and simply ran lambda-uploader without any arguments and saw this error:

⁉️ Unexpected error. Please report this traceback.
Uploader: 1.2.0
Botocore: 1.4.8
Boto3: 1.8.3

Traceback (most recent call last):
  File "/home/butla/.local/lib/python3.6/site-packages/lambda_uploader/shell.py", line 193, in main
    _execute(args)
  File "/home/butla/.local/lib/python3.6/site-packages/lambda_uploader/shell.py", line 58, in _execute
    variables=args.variables)
  File "/home/butla/.local/lib/python3.6/site-packages/lambda_uploader/config.py", line 54, in __init__
    self._validate_subscription()
  File "/home/butla/.local/lib/python3.6/site-packages/lambda_uploader/config.py", line 169, in _validate_subscription
    validate_kinesis()
  File "/home/butla/.local/lib/python3.6/site-packages/lambda_uploader/config.py", line 155, in validate_kinesis
    if ksub['starting_position'] not in valid_starting_pos:
KeyError: 'starting_position'

More info:

martinb3 commented 6 years ago

Thanks for the report! It looks like perhaps stream, batch_size, and starting_position are required fields, but we left off starting_position from the example in the README.md. It should be set to TRIM_HORIZON, LATEST, or AT_TIMESTAMP. Try that and let us know if that fixes it?

butla commented 6 years ago

Oh. I kind of assumed that all the missing values will be filled in with the values from the current configuration in AWS. Too be fair, that might have been a stretch :) Definitely, a clear error message will help. Should I leave the issue open until the example is fixed and/or error message is added?

BTW, I was able to upload the lambda now, but I got another error. Will report it in a separate issue in a second.