garnaat / kappa

What precedes Lambda
http://kappa.readthedocs.org/en/develop/
Apache License 2.0
902 stars 88 forks source link

Problem adding s3 event source #20

Closed galvanist closed 9 years ago

galvanist commented 9 years ago

When trying to add_event_sources (having already succesfully run a kappa config.yml create and a kappa config.yml invoke) that are s3 (the following is reproduced based on the s3 sample in the repo, albeit in eu-west-1), I get the following error:

$ kappa config.yml add_event_sources
adding event sources...
Traceback (most recent call last):
  File "/Users/me/venv_aws/bin/kappa", line 155, in <module>
    cli(obj={})
  File "/Users/me/venv_aws/lib/python2.7/site-packages/click/core.py", line 664, in __call__
    return self.main(*args, **kwargs)
  File "/Users/me/venv_aws/lib/python2.7/site-packages/click/core.py", line 644, in main
    rv = self.invoke(ctx)
  File "/Users/me/venv_aws/lib/python2.7/site-packages/click/core.py", line 991, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/me/venv_aws/lib/python2.7/site-packages/click/core.py", line 837, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/me/venv_aws/lib/python2.7/site-packages/click/core.py", line 464, in invoke
    return callback(*args, **kwargs)
  File "/Users/me/venv_aws/bin/kappa", line 142, in add_event_sources
    context.add_event_sources()
  File "/Users/me/venv_aws/lib/python2.7/site-packages/kappa/context.py", line 119, in add_event_sources
    event_source.add(self.function)
  File "/Users/me/venv_aws/lib/python2.7/site-packages/kappa/event_source.py", line 139, in add
    'InvocationRole': self._context.invoke_role_arn}}
AttributeError: 'Context' object has no attribute 'invoke_role_arn'

I've found the invoke_role_arn function was removed in commit 2bbf5face63536dfac1f17e15bb8f32b23856211.

Additionally if I manually add the event source, I get the following error when trying to get the status (this is having upgraded boto3 to 0.0.18 to make the package work at all):

$ kappa config.yml status
Policy
    TestLambdaPolicy201506151108 (arn:aws:iam::505016xxxxxx:policy/kappa/TestLambdaPolicy201506151108)
Role
    TestLambdaRole201506151108 (arn:aws:iam::505016xxxxxx:role/kappa/TestLambdaRole201506151108)
Function
    S3Sample201506151108 (arn:aws:lambda:eu-west-1:505016xxxxxx:function:S3Sample201506151108)
Event Sources
Traceback (most recent call last):
  File "/Users/me/venv_aws/bin/kappa", line 155, in <module>
    cli(obj={})
  File "/Users/me/venv_aws/lib/python2.7/site-packages/click/core.py", line 664, in __call__
    return self.main(*args, **kwargs)
  File "/Users/me/venv_aws/lib/python2.7/site-packages/click/core.py", line 644, in main
    rv = self.invoke(ctx)
  File "/Users/me/venv_aws/lib/python2.7/site-packages/click/core.py", line 991, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/me/venv_aws/lib/python2.7/site-packages/click/core.py", line 837, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/me/venv_aws/lib/python2.7/site-packages/click/core.py", line 464, in invoke
    return callback(*args, **kwargs)
  File "/Users/me/venv_aws/bin/kappa", line 124, in status
    event_source['EventSourceArn'], event_source['State'])
KeyError: 'EventSourceArn'
garnaat commented 9 years ago

Sorry for the delay in responding. I'll take a look at this now.