Skip to content
This repository has been archived by the owner on Mar 21, 2018. It is now read-only.

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

Closed
david-boles opened this issue Sep 5, 2017 · 5 comments
Closed
Labels

Comments

@david-boles
Copy link
Contributor

david-boles commented Sep 5, 2017

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
Copy link
Contributor Author

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

@Haroenv Haroenv added the bug label Sep 6, 2017
@david-boles
Copy link
Contributor Author

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
Copy link
Contributor

Haroenv commented Sep 7, 2017

Thanks a lot!

@pixelastic
Copy link
Contributor

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

@pixelastic
Copy link
Contributor

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!

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

No branches or pull requests

3 participants