algolia / algoliasearch-jekyll

⚠ DEPRECATED Use jekyll-algolia instead.
https://community.algolia.com/jekyll-algolia/
MIT License
125 stars 12 forks source link

Algolia push error: "no implicit conversion of nil into Hash" #57

Closed david-boles closed 6 years ago

david-boles commented 7 years ago

Jekyll site, stacktrace:

/var/lib/gems/2.3.0/gems/algoliasearch-jekyll-0.8.2/lib/record_extractor.rb:15:in `merge': no implicit conversion of nil into Hash (TypeError)
    from /var/lib/gems/2.3.0/gems/algoliasearch-jekyll-0.8.2/lib/record_extractor.rb:15:in `initialize'
    from /var/lib/gems/2.3.0/gems/algoliasearch-jekyll-0.8.2/lib/push.rb:90:in `new'
    from /var/lib/gems/2.3.0/gems/algoliasearch-jekyll-0.8.2/lib/push.rb:90:in `block in write'
    from /var/lib/gems/2.3.0/gems/jekyll-3.5.1/lib/jekyll/site.rb:333:in `block (2 levels) in each_site_file'
    from /var/lib/gems/2.3.0/gems/jekyll-3.5.1/lib/jekyll/site.rb:332:in `each'
    from /var/lib/gems/2.3.0/gems/jekyll-3.5.1/lib/jekyll/site.rb:332:in `block in each_site_file'
    from /var/lib/gems/2.3.0/gems/jekyll-3.5.1/lib/jekyll/site.rb:331:in `each'
    from /var/lib/gems/2.3.0/gems/jekyll-3.5.1/lib/jekyll/site.rb:331:in `each_site_file'
    from /var/lib/gems/2.3.0/gems/algoliasearch-jekyll-0.8.2/lib/push.rb:87:in `write'
    from /var/lib/gems/2.3.0/gems/jekyll-3.5.1/lib/jekyll/site.rb:75:in `process'
    from /var/lib/gems/2.3.0/gems/algoliasearch-jekyll-0.8.2/lib/algoliasearch-jekyll.rb:33:in `block (3 levels) in init_with_program'
    from /var/lib/gems/2.3.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `block in execute'
    from /var/lib/gems/2.3.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `each'
    from /var/lib/gems/2.3.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `execute'
    from /var/lib/gems/2.3.0/gems/mercenary-0.3.6/lib/mercenary/program.rb:42:in `go'
    from /var/lib/gems/2.3.0/gems/mercenary-0.3.6/lib/mercenary.rb:19:in `program'
    from /var/lib/gems/2.3.0/gems/jekyll-3.5.1/exe/jekyll:13:in `<top (required)>'
    from /usr/local/bin/jekyll:23:in `load'
    from /usr/local/bin/jekyll:23:in `<main>'

Anything else I can provide?

david-boles commented 7 years ago

I'm building entirely from the command line with: ALGOLIA_APPLICATION_ID="XNTLRPVD7E" ALGOLIA_INDEX_NAME="CFRCR" ALGOLIA_API_KEY="<my admin key>" jekyll algolia push --trace

david-boles commented 7 years ago

I dug into the code just a tiny bit and it looks like an issue when you don't specify anything for algolia: in your config. I added it with the application_id and index_name and it no longer errors. Unfortunately I don't know Ruby to fix it myself but it looks trivial.

Haroenv commented 7 years ago

Thanks a lot!

pixelastic commented 7 years ago

Thanks for the report and for digging into the code @david476. I'll have this fixed :)

pixelastic commented 6 years ago

The new version of the plugin (renamed to jekyll-algolia) should have this fixed. With it you can pass application id, api key and index name either from the config file or from the command line.

It should also display friendlier error messages in case one of the config is missing.

Let me know if you can get the new version a test run and see if it fixes your issue. I haven't written a complete migration guide yet, but the README should give you enough pointers for a start.

Thanks for reporting the issue in the first place!