contentful / jekyll-contentful-data-import

Contentful Plugin for the Jekyll Static Site Generator
MIT License
101 stars 32 forks source link

No support for rich text data type? #74

Open soggie opened 5 years ago

soggie commented 5 years ago

Jeez this took a while to debug. Apparently richtext field type is not supported.

RichText
Traceback (most recent call last):
    33: from /Users/soggie/.rvm/gems/ruby-2.5.3/bin/ruby_executable_hooks:24:in `<main>'
    32: from /Users/soggie/.rvm/gems/ruby-2.5.3/bin/ruby_executable_hooks:24:in `eval'
    31: from /Users/soggie/.rvm/gems/ruby-2.5.3/bin/jekyll:23:in `<main>'
    30: from /Users/soggie/.rvm/gems/ruby-2.5.3/bin/jekyll:23:in `load'
    29: from /Users/soggie/.rvm/gems/ruby-2.5.3/gems/jekyll-3.8.6/exe/jekyll:15:in `<top (required)>'
    28: from /Users/soggie/.rvm/gems/ruby-2.5.3/gems/mercenary-0.3.6/lib/mercenary.rb:19:in `program'
    27: from /Users/soggie/.rvm/gems/ruby-2.5.3/gems/mercenary-0.3.6/lib/mercenary/program.rb:42:in `go'
    26: from /Users/soggie/.rvm/gems/ruby-2.5.3/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `execute'
    25: from /Users/soggie/.rvm/gems/ruby-2.5.3/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `each'
    24: from /Users/soggie/.rvm/gems/ruby-2.5.3/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `block in execute'
    23: from /Users/soggie/.rvm/gems/ruby-2.5.3/gems/jekyll-contentful-data-import-1.8.1/lib/jekyll/commands/contentful.rb:33:in `block in command_action'
    22: from /Users/soggie/.rvm/gems/ruby-2.5.3/gems/jekyll-contentful-data-import-1.8.1/lib/jekyll/commands/contentful.rb:40:in `process'
    21: from /Users/soggie/.rvm/gems/ruby-2.5.3/gems/jekyll-contentful-data-import-1.8.1/lib/jekyll-contentful-data-import/importer.rb:21:in `run'
    20: from /Users/soggie/.rvm/gems/ruby-2.5.3/gems/jekyll-contentful-data-import-1.8.1/lib/jekyll-contentful-data-import/importer.rb:21:in `each'
    19: from /Users/soggie/.rvm/gems/ruby-2.5.3/gems/jekyll-contentful-data-import-1.8.1/lib/jekyll-contentful-data-import/importer.rb:29:in `block in run'
    18: from /Users/soggie/.rvm/gems/ruby-2.5.3/gems/jekyll-contentful-data-import-1.8.1/lib/jekyll-contentful-data-import/importer.rb:34:in `export_data'
    17: from /Users/soggie/.rvm/gems/ruby-2.5.3/gems/jekyll-contentful-data-import-1.8.1/lib/jekyll-contentful-data-import/importer.rb:79:in `get_entries'
    16: from /Users/soggie/.rvm/gems/ruby-2.5.3/gems/contentful-2.6.0/lib/contentful/client.rb:168:in `entries'
    15: from /Users/soggie/.rvm/gems/ruby-2.5.3/gems/contentful-2.6.0/lib/contentful/request.rb:30:in `get'
    14: from /Users/soggie/.rvm/gems/ruby-2.5.3/gems/contentful-2.6.0/lib/contentful/client.rb:308:in `get'
    13: from /Users/soggie/.rvm/gems/ruby-2.5.3/gems/contentful-2.6.0/lib/contentful/client.rb:371:in `do_build_resource'
    12: from /Users/soggie/.rvm/gems/ruby-2.5.3/gems/contentful-2.6.0/lib/contentful/resource_builder.rb:52:in `run'
    11: from /Users/soggie/.rvm/gems/ruby-2.5.3/gems/contentful-2.6.0/lib/contentful/resource_builder.rb:64:in `build_array'
    10: from /Users/soggie/.rvm/gems/ruby-2.5.3/gems/contentful-2.6.0/lib/contentful/resource_builder.rb:64:in `map'
     9: from /Users/soggie/.rvm/gems/ruby-2.5.3/gems/contentful-2.6.0/lib/contentful/resource_builder.rb:66:in `block in build_array'
     8: from /Users/soggie/.rvm/gems/ruby-2.5.3/gems/contentful-2.6.0/lib/contentful/resource_builder.rb:90:in `build_item'
     7: from /Users/soggie/.rvm/gems/ruby-2.5.3/gems/contentful-2.6.0/lib/contentful/resource_builder.rb:90:in `new'
     6: from /Users/soggie/.rvm/gems/ruby-2.5.3/gems/contentful-2.6.0/lib/contentful/fields_resource.rb:14:in `initialize'
     5: from /Users/soggie/.rvm/gems/ruby-2.5.3/gems/contentful-2.6.0/lib/contentful/fields_resource.rb:128:in `hydrate_fields'
     4: from /Users/soggie/.rvm/gems/ruby-2.5.3/gems/contentful-2.6.0/lib/contentful/fields_resource.rb:108:in `hydrate_nonlocalized_fields'
     3: from /Users/soggie/.rvm/gems/ruby-2.5.3/gems/contentful-2.6.0/lib/contentful/fields_resource.rb:108:in `each'
     2: from /Users/soggie/.rvm/gems/ruby-2.5.3/gems/contentful-2.6.0/lib/contentful/fields_resource.rb:110:in `block in hydrate_nonlocalized_fields'
     1: from /Users/soggie/.rvm/gems/ruby-2.5.3/gems/contentful-2.6.0/lib/contentful/entry.rb:29:in `coerce'
/Users/soggie/.rvm/gems/ruby-2.5.3/gems/contentful-2.6.0/lib/contentful/field.rb:45:in `coerce': undefined method `new' for nil:NilClass (NoMethodError)

Tracing KNOWN_TYPES gives me:

{"String":"Contentful::StringCoercion","Text":"Contentful::TextCoercion","Symbol":"Contentful::SymbolCoercion","Integer":"Contentful::IntegerCoercion","Number":"Contentful::FloatCoercion","Boolean":"Contentful::BooleanCoercion","Date":"Contentful::DateCoercion","Location":"Contentful::LocationCoercion","Object":"Contentful::ObjectCoercion","Array":"Contentful::ArrayCoercion","Link":"Contentful::LinkCoercion"}

As you can see, richtext is not one of the known types. Also, there should be better error handling there.

dlitvakb commented 5 years ago

Hi @soggie,

Looks like you're using an outdated version 2.6.0 of the Contentful CDA SDK. The version that added support for RichText is 2.10.0. The current version is 2.13.3.

Please make sure to update to the latest version and try again.

Cheers