Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: no implicit conversion of String into Integer #16

Closed
ANGOmarcello opened this issue Apr 19, 2018 · 7 comments
Closed

Error: no implicit conversion of String into Integer #16

ANGOmarcello opened this issue Apr 19, 2018 · 7 comments

Comments

@ANGOmarcello
Copy link

ANGOmarcello commented Apr 19, 2018

Hey there,

Im currently not able to use jekyll-gitlab-letsencrypt I always get the same error:
jekyll 3.7.0 | Error: no implicit conversion of String into Integer

My Jekyll version is 3.7.0 and Ruby is ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-darwin16]

My config looks like this:
permalink: pretty

sass:
sass_dir: /styles/imports

gitlab-letsencrypt:
Gitlab settings:
personal_access_token: MY TOKEN IS USALLY HERE # GitLab Private Access Token use with env variable
gitlab_repo: 'kindredone/webseite' # Namespaced repository identifier

Domain settings:
email: MY MAIL IS USUALLY HERE # Let's Encrypt email address
domain: 'kindred.one' # Domain that the cert will be issued for

Jekyll settings:
base_path: './' # Where you want the file to go
pretty_url: true # Add a "/" on the end of the URL... set to true if you use permalink_style: pretty
filename: 'letsencrypt.html' # What to call the generated challenge file

Delay settings:
initial_delay: 120 # How long to wait for Gitlab CI to push your changes before it starts checking
delay_time: 15 # How long to wait between each check once it starts looking for the file`

I'm not to sure currently what is causing this problem but it seems to always be present, even on commits that previously worked with lets encrypt.

Does anyone else have this problem or knows if it is caused by jekyll-gitlab-letsencrypt and if not of a possible other cause?

My research so far has basically yielded no results at all. :(

@JustinAiken
Copy link
Owner

I just tried updating my own blog's Jekyll verison to 3.7.0 and ran, it still worked..

  • So you're seeing this error on bundle exec jekyll letsencrypt, or on anything jekyll'y?
  • Can you try running with --trace and paste the full output?

@ANGOmarcello
Copy link
Author

ANGOmarcello commented Apr 20, 2018

Hey there,
Thanks for the tip with --trace. This is my output:

`Mothership:Webseite aca$ bundle exec jekyll letsencrypt --trace
Configuration file: /Volumes/Storage/Web Projekte Kindred/Webseite/_config.yml
Registering MAIL to https://acme-v01.api.letsencrypt.org/...
Pushing file to Gitlab
bundler: failed to load command: jekyll (/usr/local/bin/jekyll)
TypeError: no implicit conversion of String into Integer
  /usr/local/lib/ruby/gems/2.4.0/gems/jekyll-gitlab-letsencrypt-0.2.1/lib/jekyll/gitlab/letsencrypt/gitlab_client.rb:59:in `[]'
  /usr/local/lib/ruby/gems/2.4.0/gems/jekyll-gitlab-letsencrypt-0.2.1/lib/jekyll/gitlab/letsencrypt/gitlab_client.rb:59:in `block in branch_exists?'
  /usr/local/lib/ruby/gems/2.4.0/gems/jekyll-gitlab-letsencrypt-0.2.1/lib/jekyll/gitlab/letsencrypt/gitlab_client.rb:59:in `any?'
  /usr/local/lib/ruby/gems/2.4.0/gems/jekyll-gitlab-letsencrypt-0.2.1/lib/jekyll/gitlab/letsencrypt/gitlab_client.rb:59:in `branch_exists?'
  /usr/local/lib/ruby/gems/2.4.0/gems/jekyll-gitlab-letsencrypt-0.2.1/lib/jekyll/gitlab/letsencrypt/gitlab_client.rb:14:in `commit!'
  /usr/local/lib/ruby/gems/2.4.0/gems/jekyll-gitlab-letsencrypt-0.2.1/lib/jekyll/gitlab/letsencrypt/process.rb:42:in `commit_to_gitlab!'
  /usr/local/lib/ruby/gems/2.4.0/gems/jekyll-gitlab-letsencrypt-0.2.1/lib/jekyll/gitlab/letsencrypt/process.rb:24:in `process!'
  /usr/local/lib/ruby/gems/2.4.0/gems/jekyll-gitlab-letsencrypt-0.2.1/lib/jekyll/gitlab/letsencrypt/process.rb:12:in `process!'
  /usr/local/lib/ruby/gems/2.4.0/gems/jekyll-gitlab-letsencrypt-0.2.1/lib/jekyll/commands/gitlab/letsencrypt.rb:10:in `block (2 levels) in init_with_program'
  /usr/local/lib/ruby/gems/2.4.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `block in execute'
  /usr/local/lib/ruby/gems/2.4.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `each'
  /usr/local/lib/ruby/gems/2.4.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `execute'
  /usr/local/lib/ruby/gems/2.4.0/gems/mercenary-0.3.6/lib/mercenary/program.rb:42:in `go'
  /usr/local/lib/ruby/gems/2.4.0/gems/mercenary-0.3.6/lib/mercenary.rb:19:in `program'
  /usr/local/lib/ruby/gems/2.4.0/gems/jekyll-3.7.0/exe/jekyll:15:in `<top (required)>'
  /usr/local/bin/jekyll:22:in `load'
  /usr/local/bin/jekyll:22:in `<top (required)>'`

I think what this actually tells me is, that despite using bundle exec, jekyll-gitlab-letsencrypt wants to use my system version of Jekyll and not the one from my gem file. This breaks the functionality of bundle exec at all if I'm not mistaken.

@JustinAiken
Copy link
Owner

Hmm, it's failing on this line:

JSON.parse(response.body).any? { |json| json['name'] == branch }

Which would suggest that json is an array instead of a hash... that seems odd.. something must be coming back oddly from the gitlab API when you request the branches endpoint. If you could open the file locally and put a Jekyll.logger.info response.body in between the getting and the line it blows up, it should give us a bit more information

@ANGOmarcello
Copy link
Author

Thanks for your help, I think I was able to isolate the cause of my problem, as the additional logging returns {"error":"404 Not Found"} for me.
I think this has todo with me modifying the name of my gitlab project, as the urls for checkout haven't changed by this, it seems the name the gitlab api wants to hear has.

The next problem for me is now finding out what the Gitlab API wants to hear, as simply using the new name in config does not work. :( But this is definitely not caused by Jekyll-gitlab-letsencrypt.

@ANGOmarcello
Copy link
Author

After digging further I have found that the token i used previously (api - permission) has no longer sufficient rights to pull such information. After creating a token with more powerful permissions (ticking everything on for testing) it worked.

@JustinAiken
Copy link
Owner

Thanks for tracking it down! Keep the issue open, and I'll add some logging/error handling so the next person with an insufficiently-permissioned token gets a clearer message instead of mysterious crashes about strings and integers

@JustinAiken
Copy link
Owner

Should be fixed by #17

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants