jorgebastida / gordon

λ Gordon is a tool to create, wire and deploy AWS Lambdas using CloudFormation
Other
2.05k stars 137 forks source link

Telegram Bot Example #9

Closed Beyondem closed 8 years ago

Beyondem commented 8 years ago

Seems to be a bit of an issue with the Telegram bot example. Tried getting it going as is (Just updating my tokens) and upon apply:

$ gordon apply
Applying project...
  0001_p.json (cloudformation)
    CREATE_FAILED waiting... |
  0002_pr_r.json (custom)
Traceback (most recent call last):
  File "C:\Python27\Scripts\gordon-script.py", line 9, in <module>
    load_entry_point('gordon==0.2.0', 'console_scripts', 'gordon')()
  File "C:\Python27\lib\site-packages\gordon-0.2.0-py2.7.egg\gordon\bin.py", line 97, in main
    getattr(obj, options.func)()
  File "C:\Python27\lib\site-packages\gordon-0.2.0-py2.7.egg\gordon\core.py", line 432, in apply
    getattr(self, 'apply_{}_template'.format(template_type))(name, filename, context)
  File "C:\Python27\lib\site-packages\gordon-0.2.0-py2.7.egg\gordon\core.py", line 476, in apply_custom_template
    outputs = template.apply(context, self)
  File "C:\Python27\lib\site-packages\gordon-0.2.0-py2.7.egg\gordon\actions.py", line 131, in apply
    action_outputs[action.name] = action.apply(context, project)
  File "C:\Python27\lib\site-packages\gordon-0.2.0-py2.7.egg\gordon\actions.py", line 181, in apply
    self.bucket = self._get('bucket', self.context)
  File "C:\Python27\lib\site-packages\gordon-0.2.0-py2.7.egg\gordon\actions.py", line 156, in _get
    value = context[value.name]
KeyError: u'CodeBucket'

Any idea whats going on here? I tried adding another option to settings.yml as a duplicate of "code-bucket" renamed as "CodeBucket" and still no luck.

jorgebastida commented 8 years ago

It looks like the creation of the project stack (where the bucket is created has failed). This can happen for a number of reasons including the fact that the bucket name might be duplicated.

Now that you have changed the code bucket in your settings.yml you can run something like:

$ gordon delete --confirm
$ gordon apply

I need to make the apply process stop if any of the steps don't finish successfully.

Beyondem commented 8 years ago

I have tried running the delete command, as well as manually going through and clearing out of the account.

The cloudformation error seems to state that the S3 bucket already exists; but it definitely does not. Very strange.

ausmith commented 8 years ago

@Beyondem don't forget that bucket names must be globally unique, not just unique to your account. This is an S3 "feature" that allows for us to have globally accessible s3 bucket URLs, but also results in issues with trying to create a bucket called logs since someone undoubtedly has that already.

Not sure if that's what is impacting you here, but thought I'd mention it.

Beyondem commented 8 years ago

I did not know that!

I just tried changing the code-bucket name and it seems to be going now!

May I suggest adding that detail to the Telegram bot example readme?

Thanks !

ausmith commented 8 years ago

The global uniqueness of S3 bucket names is mentioned in the S3 documentation in the 4th paragraph of http://docs.aws.amazon.com/AmazonS3/latest/dev/UsingBucket.html -- to me this is not defined clearly enough, lending itself to documentation happening in this example. Working on a PR to accomplish that.

jorgebastida commented 8 years ago

This has been merged. Will think about how to make people not face this problem in the future - if they don't read the note I mean :D