Skip to content
New issue

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

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

Already on GitHub? # to your account

2.2.1 release causing a jekyll-algolia "TypeError: no implicit conversion of nil into Hash after upgrading Gemfile" #138

Closed
mkiser opened this issue Apr 22, 2019 · 13 comments · Fixed by #139

Comments

@mkiser
Copy link

mkiser commented Apr 22, 2019

It appears that something in the v2.2.1 release is breaking the jekyll-aloglia plugin and resulting in a TypeError: no implicit conversion of nil into Hash after upgrading Gemfile error

Reference: algolia/jekyll-algolia#121 (comment)

Wish I could provide more insight, but I'm out of my element here, unfortunately.

@ashmaroli
Copy link
Member

@mkiser This bug has been addressed on master already. If possible, pointing your Gemfile to this repo's master branch should resolve your issue:

# Gemfile

gem "jekyll-archives", git: "https://github.com/jekyll/jekyll-archives.git", branch: "master"

Do get back to us and we shall release a v2.2.2 of this plugin..

@mkiser
Copy link
Author

mkiser commented Apr 23, 2019

I was using v2.2.1 as of today and it was causing this issue. Downgrading resolved the issue. Not sure I understand the point of versions and pointing to master.

@ashmaroli
Copy link
Member

Not sure I understand the point of versions and pointing to master.

Pointing to master is a temporary move to test the fix that has not been released. You need not commit the change to your repo. Simply, testing with the master branch locally should let us know if this issue has been actually fixed..

@nhoizey
Copy link

nhoizey commented Apr 23, 2019

@ashmaroli I have the same issue and tried to use this repo's master branch, but algolia indexing still doesn't work.

@ashmaroli
Copy link
Member

Thanks for the feedback @nhoizey. Is the error / stack trace any different with the master branch?

@nhoizey
Copy link

nhoizey commented Apr 23, 2019

It looks they are the same:

With 2.2.1:

bundler: failed to load command: jekyll (/usr/local/lib/ruby/gems/2.6.0/bin/jekyll)
TypeError: no implicit conversion of nil into Hash
  /usr/local/lib/ruby/gems/2.6.0/gems/jekyll-3.8.5/lib/jekyll/utils.rb:318:in `merge!'
  /usr/local/lib/ruby/gems/2.6.0/gems/jekyll-3.8.5/lib/jekyll/utils.rb:318:in `merge_values'
  /usr/local/lib/ruby/gems/2.6.0/gems/jekyll-3.8.5/lib/jekyll/utils.rb:50:in `deep_merge_hashes!'
  /usr/local/lib/ruby/gems/2.6.0/gems/jekyll-3.8.5/lib/jekyll/utils.rb:37:in `deep_merge_hashes'
  /usr/local/lib/ruby/gems/2.6.0/gems/jekyll-archives-2.2.1/lib/jekyll-archives.rb:27:in `initialize'
  /usr/local/lib/ruby/gems/2.6.0/gems/jekyll-3.8.5/lib/jekyll/site.rb:295:in `new'
  /usr/local/lib/ruby/gems/2.6.0/gems/jekyll-3.8.5/lib/jekyll/site.rb:295:in `block in instantiate_subclasses'
  /usr/local/lib/ruby/gems/2.6.0/gems/jekyll-3.8.5/lib/jekyll/site.rb:294:in `map'
  /usr/local/lib/ruby/gems/2.6.0/gems/jekyll-3.8.5/lib/jekyll/site.rb:294:in `instantiate_subclasses'
  /usr/local/lib/ruby/gems/2.6.0/gems/jekyll-3.8.5/lib/jekyll/site.rb:117:in `setup'
  /usr/local/lib/ruby/gems/2.6.0/gems/jekyll-3.8.5/lib/jekyll/site.rb:32:in `initialize'
  /usr/local/lib/ruby/gems/2.6.0/gems/jekyll-algolia-1.4.11/lib/jekyll-algolia.rb:36:in `new'
  /usr/local/lib/ruby/gems/2.6.0/gems/jekyll-algolia-1.4.11/lib/jekyll-algolia.rb:36:in `init'
  /usr/local/lib/ruby/gems/2.6.0/gems/jekyll-algolia-1.4.11/lib/jekyll/commands/algolia.rb:31:in `block (2 levels) in init_with_program'
  /usr/local/lib/ruby/gems/2.6.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `block in execute'
  /usr/local/lib/ruby/gems/2.6.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `each'
  /usr/local/lib/ruby/gems/2.6.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `execute'
  /usr/local/lib/ruby/gems/2.6.0/gems/mercenary-0.3.6/lib/mercenary/program.rb:42:in `go'
  /usr/local/lib/ruby/gems/2.6.0/gems/mercenary-0.3.6/lib/mercenary.rb:19:in `program'
  /usr/local/lib/ruby/gems/2.6.0/gems/jekyll-3.8.5/exe/jekyll:15:in `<top (required)>'
  /usr/local/lib/ruby/gems/2.6.0/bin/jekyll:23:in `load'
  /usr/local/lib/ruby/gems/2.6.0/bin/jekyll:23:in `<top (required)>'

With master:

bundler: failed to load command: jekyll (/usr/local/lib/ruby/gems/2.6.0/bin/jekyll)
TypeError: no implicit conversion of nil into Hash
  /usr/local/lib/ruby/gems/2.6.0/gems/jekyll-3.8.5/lib/jekyll/utils.rb:318:in `merge!'
  /usr/local/lib/ruby/gems/2.6.0/gems/jekyll-3.8.5/lib/jekyll/utils.rb:318:in `merge_values'
  /usr/local/lib/ruby/gems/2.6.0/gems/jekyll-3.8.5/lib/jekyll/utils.rb:50:in `deep_merge_hashes!'
  /usr/local/lib/ruby/gems/2.6.0/gems/jekyll-3.8.5/lib/jekyll/utils.rb:37:in `deep_merge_hashes'
  /usr/local/lib/ruby/gems/2.6.0/bundler/gems/jekyll-archives-3d5301e14a00/lib/jekyll-archives.rb:27:in `initialize'
  /usr/local/lib/ruby/gems/2.6.0/gems/jekyll-3.8.5/lib/jekyll/site.rb:295:in `new'
  /usr/local/lib/ruby/gems/2.6.0/gems/jekyll-3.8.5/lib/jekyll/site.rb:295:in `block in instantiate_subclasses'
  /usr/local/lib/ruby/gems/2.6.0/gems/jekyll-3.8.5/lib/jekyll/site.rb:294:in `map'
  /usr/local/lib/ruby/gems/2.6.0/gems/jekyll-3.8.5/lib/jekyll/site.rb:294:in `instantiate_subclasses'
  /usr/local/lib/ruby/gems/2.6.0/gems/jekyll-3.8.5/lib/jekyll/site.rb:117:in `setup'
  /usr/local/lib/ruby/gems/2.6.0/gems/jekyll-3.8.5/lib/jekyll/site.rb:32:in `initialize'
  /usr/local/lib/ruby/gems/2.6.0/gems/jekyll-algolia-1.4.11/lib/jekyll-algolia.rb:36:in `new'
  /usr/local/lib/ruby/gems/2.6.0/gems/jekyll-algolia-1.4.11/lib/jekyll-algolia.rb:36:in `init'
  /usr/local/lib/ruby/gems/2.6.0/gems/jekyll-algolia-1.4.11/lib/jekyll/commands/algolia.rb:31:in `block (2 levels) in init_with_program'
  /usr/local/lib/ruby/gems/2.6.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `block in execute'
  /usr/local/lib/ruby/gems/2.6.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `each'
  /usr/local/lib/ruby/gems/2.6.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `execute'
  /usr/local/lib/ruby/gems/2.6.0/gems/mercenary-0.3.6/lib/mercenary/program.rb:42:in `go'
  /usr/local/lib/ruby/gems/2.6.0/gems/mercenary-0.3.6/lib/mercenary.rb:19:in `program'
  /usr/local/lib/ruby/gems/2.6.0/gems/jekyll-3.8.5/exe/jekyll:15:in `<top (required)>'
  /usr/local/lib/ruby/gems/2.6.0/bin/jekyll:23:in `load'
  /usr/local/lib/ruby/gems/2.6.0/bin/jekyll:23:in `<top (required)>'

@nhoizey
Copy link

nhoizey commented Apr 23, 2019

I don't if this comment from @borisschapira can help:
algolia/jekyll-algolia#121 (comment)

@ashmaroli
Copy link
Member

The actual cause is reflected in @borisschapira's comment. jekyll-algolia is setting the config["jekyll-archives"] to nil. But ideally, it should just delete the key-value pair entirely.

def self.disable_other_plugins(config)
  # Disable archive pages from jekyll-archives
-   config['jekyll-archives'] = nil
+   config.delete("jekyll-archives")

I could patch jekyll-archives to handle the scenario silently without failing. But, I think its better that the master fails due to an invalid configuration.
IMO, the current behavior of jekyll-archives need not be changed. Nevertheless, I may submit a PR to gracefully fail when the config has been explicitly set to nil

@ashmaroli
Copy link
Member

ashmaroli commented Apr 23, 2019

@jekyll/plugin-core Should we handle a nil (or any non-hash) config silently or explicitly raise a Jekyll::Errors::InvalidConfigurationError..?

@mattr-
Copy link
Member

mattr- commented Apr 23, 2019

I wouldn't handle it silently. We should detect an invalid configuration, print a warning, and then just disable the plugin.

@ashmaroli
Copy link
Member

and then just disable the plugin.

I don't think there's an API for that.. The easiest way is to abort the build..

@mattr-
Copy link
Member

mattr- commented Apr 23, 2019

You don't need an API for that and you don't need to abort the build. The plugin operations just need to do nothing.

@ashmaroli
Copy link
Member

Ahh okay. I took your "disable the plugin" comment too seriously..

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants