Skip to content
This repository has been archived by the owner on May 8, 2024. It is now read-only.

Error Importing Content #9

Closed
bamboocreative opened this issue Apr 20, 2016 · 11 comments
Closed

Error Importing Content #9

bamboocreative opened this issue Apr 20, 2016 · 11 comments
Assignees
Labels

Comments

@bamboocreative
Copy link

Having an issue running bundle exec jekyll conetntful

Keep getting jekyll 3.1.3 | Error: undefined method[]' for nil:NilClass`

Full trace:

bundle exec jekyll contentful --trace
Configuration file: /Users/leylandjacob/dev/clients/ROCKLIN/_config.yml
Starting Contentful import 
/Library/Ruby/Gems/2.0.0/gems/jekyll-contentful-data-import-1.2.1/lib/jekyll-contentful-data-import/importer.rb:16:in `block in run': undefined method `[]' for nil:NilClass (NoMethodError)
        from /Library/Ruby/Gems/2.0.0/gems/jekyll-contentful-data-import-1.2.1/lib/jekyll-contentful-data-import/importer.rb:14:in `each'
        from /Library/Ruby/Gems/2.0.0/gems/jekyll-contentful-data-import-1.2.1/lib/jekyll-contentful-data-import/importer.rb:14:in `run'
        from /Library/Ruby/Gems/2.0.0/gems/jekyll-contentful-data-import-1.2.1/lib/jekyll/commands/contentful.rb:30:in `process'
        from /Library/Ruby/Gems/2.0.0/gems/jekyll-contentful-data-import-1.2.1/lib/jekyll/commands/contentful.rb:15:in `block (2 levels) in init_with_program'
        from /Library/Ruby/Gems/2.0.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `call'
        from /Library/Ruby/Gems/2.0.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `block in execute'
        from /Library/Ruby/Gems/2.0.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `each'
        from /Library/Ruby/Gems/2.0.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `execute'
        from /Library/Ruby/Gems/2.0.0/gems/mercenary-0.3.6/lib/mercenary/program.rb:42:in `go'
        from /Library/Ruby/Gems/2.0.0/gems/mercenary-0.3.6/lib/mercenary.rb:19:in `program'
        from /Library/Ruby/Gems/2.0.0/gems/jekyll-3.1.3/bin/jekyll:13:in `<top (required)>'
        from /usr/local/bin/jekyll:23:in `load'
        from /usr/local/bin/jekyll:23:in `<main>'
@dlitvakb
Copy link
Contributor

Hey @bamboocreative,

Can you share the contentful block of your _config.yml file so we can look at what might be happening? Obfuscate your keys if content is not public

Cheers

@dlitvakb dlitvakb self-assigned this Apr 21, 2016
@bamboocreative
Copy link
Author

bamboocreative commented Apr 21, 2016

See below @dlitvakb. Out of curiosity, would this be caused by needing to upgrade the account?

contentful:
  spaces:
    - example:
      space: 1234_space_id
      access_token: 1234_production_content_delivery_api_key

@dlitvakb
Copy link
Contributor

Hey @bamboocreative,

Found your issue, the space and access_token keys are indented a level less than they what are supposed to be. YAML is a very strict white-space based format, and can be a bit painful sometimes with deeply nested structures.

What do you mean "upgrade the account"? This should work from Free to Enterprise tiers without exception.

Hope this helps

@bamboocreative
Copy link
Author

@dlitvakb you rock. I figured it was something silly like that. An yes, it works for the free account, saw a mention somewhere else that mentioned account issues. Works great now. Thanks

@dlitvakb
Copy link
Contributor

@bamboocreative No problem! Glad to help! 👍

@zuzust
Copy link

zuzust commented May 26, 2016

@dlitvakb Same issue here, but different message:

bundle exec jekyll contentful --trace  
Configuration file: /home/carles/Projectes/jekyll/jekyll.me/_config.yml  
Starting Contentful import  
/home/carles/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/jekyll-contentful-data-import-1.2.1/lib/jekyll-contentful-data-import/mappers/base.rb:50: stack level too deep (SystemStackError)

This is my Gemfile:

source 'https://rubygems.org'

gem 'jekyll', '3.1.3'
gem 'contentful_bootstrap'

group :jekyll_plugins do
  gem 'jekyll-contentful-data-import'
end

And this my config settings:

contentful:
  spaces:
    - example:
        space: SPACE_ID
        access_token: TOKEN
        cda_query:
          include: 2

@dlitvakb
Copy link
Contributor

Hey @zuzust,

Can you provide me your Content Types JSON Preview? Do you happen to have any circular reference?

Cheers

@dlitvakb dlitvakb reopened this May 26, 2016
@zuzust
Copy link

zuzust commented May 26, 2016

@dlitvakb sure, here you are...

Author.txt
Category.txt
Cat_videos.txt
Post.txt

@dlitvakb
Copy link
Contributor

Hey @zuzust,

In fact, you have a circular reference between Author and Post, therefore creating this infinite loop which causes your error, please consider removing the link from author to posts (in your author content type), as your post will already include author data, and if you need the back reference you can fetch it with a quick search over your already serialised data.

Hope that helps

@zuzust
Copy link

zuzust commented May 26, 2016

@dlitvakb, you are right. Disabling that reference from response it works fine. Thanks!

@dlitvakb
Copy link
Contributor

Glad it worked!

Closing the issue

@djoos djoos mentioned this issue Feb 21, 2019
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