aarongustafson / jekyll-webmention_io

A Jekyll Plugin for rendering Webmentions via Webmention.io
https://aarongustafson.github.io/jekyll-webmention_io/
MIT License
139 stars 27 forks source link

Bug: NoMethodError: undefined method `[]' for nil:NilClass #40

Closed 0xdevalias closed 7 years ago

0xdevalias commented 7 years ago

If I wipe my cache folder, and run the below command, it seems to work properly (at least doesn't crash). The 2nd time I run it, I get the following.

I'm also not seeing any actual mentions, even though I am pretty certain there should be (querying webmention.io for my domain using the key shows me a number that don't show up)

⇒  JEKYLL_ENV=development jekyll serve --drafts --trace
Configuration file: /Users/devalias/dev/devalias.net/_config.yml
Configuration file: /Users/devalias/dev/devalias.net/_config.yml
Configuration file: /Users/devalias/dev/devalias.net/_config.yml
            Source: /Users/devalias/dev/devalias.net
       Destination: /Users/devalias/dev/devalias.net/_site
 Incremental build: disabled. Enable with --incremental
      Generating...
[jekyll-webmention_io] Beginning to gather webmentions of your posts. This may take a while.
bundler: failed to load command: jekyll (/Users/devalias/.rbenv/versions/2.3.0/bin/jekyll)
NoMethodError: undefined method `[]' for nil:NilClass
  /Users/devalias/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/jekyll-webmention_io-2.5.0/lib/jekyll/generators/gather_webmentions.rb:52:in `block in generate'
  /Users/devalias/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/jekyll-webmention_io-2.5.0/lib/jekyll/generators/gather_webmentions.rb:44:in `each'
  /Users/devalias/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/jekyll-webmention_io-2.5.0/lib/jekyll/generators/gather_webmentions.rb:44:in `generate'
  /Users/devalias/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/jekyll-3.4.3/lib/jekyll/site.rb:174:in `block in generate'
  /Users/devalias/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/jekyll-3.4.3/lib/jekyll/site.rb:172:in `each'
  /Users/devalias/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/jekyll-3.4.3/lib/jekyll/site.rb:172:in `generate'
  /Users/devalias/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/jekyll-3.4.3/lib/jekyll/site.rb:68:in `process'
  /Users/devalias/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/jekyll-3.4.3/lib/jekyll/command.rb:26:in `process_site'
  /Users/devalias/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/jekyll-3.4.3/lib/jekyll/commands/build.rb:63:in `build'
  /Users/devalias/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/jekyll-admin-0.4.1/lib/jekyll/commands/build.rb:9:in `build'
  /Users/devalias/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/jekyll-3.4.3/lib/jekyll/commands/build.rb:34:in `process'
  /Users/devalias/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/jekyll-3.4.3/lib/jekyll/commands/serve.rb:37:in `block (2 levels) in init_with_program'
  /Users/devalias/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `block in execute'
  /Users/devalias/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `each'
  /Users/devalias/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `execute'
  /Users/devalias/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/mercenary-0.3.6/lib/mercenary/program.rb:42:in `go'
  /Users/devalias/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/mercenary-0.3.6/lib/mercenary.rb:19:in `program'
  /Users/devalias/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/jekyll-3.4.3/exe/jekyll:13:in `<top (required)>'
  /Users/devalias/.rbenv/versions/2.3.0/bin/jekyll:23:in `load'
  /Users/devalias/.rbenv/versions/2.3.0/bin/jekyll:23:in `<top (required)>'
aarongustafson commented 7 years ago

I have a test bugfix for this. I’m pushing it to the bugfixes-2017-07-17 branch. Can you the gem from a local source and let me know if this fixes the issue?

https://github.com/aarongustafson/jekyll-webmention_io/tree/bugfixes-2017-07-17

0xdevalias commented 7 years ago

Testing that version, seems to no longer get the nil error

[jekyll-webmention_io] Beginning to gather webmentions of your posts. This may take a while.
[jekyll-webmention_io] Webmentions have been gathered and cached.
[jekyll-webmention_io] Beginning to gather webmentions you’ve made. This may take a while.
[jekyll-webmention_io] Webmentions have been gathered and cached.
                    done in 87.057 seconds.

Takes an extremely long time to go through though :(

Also, still not seeing any mentions for my URLs in the cache when I know there definitely should be some.

They look like this:

..snip..
"/devalias/2017/03/01/biohacked-box-2/": {}
"/devalias/2017/03/18/iterm-tmux-love/": {}
"/devalias/2017/07/14/link-dump-clearing-out-my-todo-list/": {}
"/devalias/2017/07/16/bugcrowd-levelup-2017/": {}

Is that right? Where/how is it reading the domain/etc?

webmentions:
  username: devalias.net
aarongustafson commented 7 years ago

Takes an extremely long time to go through though :(

It should speed up over time.

Is that right?

Yep.

Where/how is it reading the domain/etc?

It pulls the domain from the _config.yml file url value. It also factors in webmentions.legacy_domains.

0xdevalias commented 7 years ago

Cool, I need to do some digging to see exactly what the URL structure of the old mentions was then.