jarpy / lambkin

CLI tool for generating and managing simple functions in AWS Lambda
Apache License 2.0
74 stars 12 forks source link

Error when publishing unless an existing --role is specified #11

Closed dwcramer closed 7 years ago

dwcramer commented 7 years ago

Trying to get this hello world example working, I was receiving the following error until I added --role "lambda_basic_execution" to my lambkin publish command. I don't see a way to leave feedback on the article, but perhaps a note in lambkin's docs would help.

davcrame@DAVCRAME-M-G095 ~/rws/curator-lambda/serverless-curator
$ lambkin publish
Traceback (most recent call last):
  File "/Users/davcrame/rws/curator-lambda/serverless-curator/venv/bin/lambkin", line 11, in <module>
    sys.exit(main())
  File "/Users/davcrame/rws/curator-lambda/serverless-curator/venv/lib/python2.7/site-packages/lambkin/lambkin.py", line 240, in main
    cli()
  File "/Users/davcrame/rws/curator-lambda/serverless-curator/venv/lib/python2.7/site-packages/click/core.py", line 716, in __call__
    return self.main(*args, **kwargs)
  File "/Users/davcrame/rws/curator-lambda/serverless-curator/venv/lib/python2.7/site-packages/click/core.py", line 696, in main
    rv = self.invoke(ctx)
  File "/Users/davcrame/rws/curator-lambda/serverless-curator/venv/lib/python2.7/site-packages/click/core.py", line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/davcrame/rws/curator-lambda/serverless-curator/venv/lib/python2.7/site-packages/click/core.py", line 889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/davcrame/rws/curator-lambda/serverless-curator/venv/lib/python2.7/site-packages/click/core.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "/Users/davcrame/rws/curator-lambda/serverless-curator/venv/lib/python2.7/site-packages/lambkin/lambkin.py", line 146, in publish
    Role=get_role_arn(role),
  File "/Users/davcrame/rws/curator-lambda/serverless-curator/venv/lib/python2.7/site-packages/lambkin/aws.py", line 31, in get_role_arn
    return role.arn
  File "/Users/davcrame/rws/curator-lambda/serverless-curator/venv/lib/python2.7/site-packages/boto3/resources/factory.py", line 339, in property_loader
    self.load()
  File "/Users/davcrame/rws/curator-lambda/serverless-curator/venv/lib/python2.7/site-packages/boto3/resources/factory.py", line 505, in do_action
    response = action(self, *args, **kwargs)
  File "/Users/davcrame/rws/curator-lambda/serverless-curator/venv/lib/python2.7/site-packages/boto3/resources/action.py", line 83, in __call__
    response = getattr(parent.meta.client, operation_name)(**params)
  File "/Users/davcrame/rws/curator-lambda/serverless-curator/venv/lib/python2.7/site-packages/botocore/client.py", line 251, in _api_call
    return self._make_api_call(operation_name, kwargs)
  File "/Users/davcrame/rws/curator-lambda/serverless-curator/venv/lib/python2.7/site-packages/botocore/client.py", line 537, in _make_api_call
    raise ClientError(parsed_response, operation_name)
botocore.exceptions.ClientError: An error occurred (NoSuchEntity) when calling the GetRole operation: Unknown
jarpy commented 7 years ago

Fixed by @dwcramer in b59450e144a53d5737596a30d966b1ee6f8129bf.