contentful_middleman icon indicating copy to clipboard operation
contentful_middleman copied to clipboard

NoMethodError `key?' for Contentful::Link - possibly due to contentful releases

Open colinbull opened this issue 3 years ago • 1 comments

When running bundle exec middleman contentful we have started getting the following error. Previously the same content has been working but we have just started using contentful releases and I suspect that this is causing an invalid response somehow. However I have since removed the content from a release, unpublished and republished but the issue still persists.

Stack trace

9: from /home/me/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/contentful-2.16.1/lib/contentful/fields_resource.rb:13:in `initialize'
8: from /home/me/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/contentful-2.16.1/lib/contentful/base_resource.rb:18:in `initialize'
7: from /home/me/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/contentful-2.16.1/lib/contentful/base_resource.rb:100:in `hydrate_metadata'
6: from /home/me/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/contentful-2.16.1/lib/contentful/base_resource.rb:100:in `each'
5: from /home/me/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/contentful-2.16.1/lib/contentful/base_resource.rb:101:in `block in hydrate_metadata'
4: from /home/me/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/contentful-2.16.1/lib/contentful/base_resource.rb:101:in `map!'
3: from /home/me/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/contentful-2.16.1/lib/contentful/base_resource.rb:101:in `block (2 levels) in hydrate_metadata'
2: from /home/me/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/contentful-2.16.1/lib/contentful/base_resource.rb:119:in `build_link'
1: from /home/me/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/contentful-2.16.1/lib/contentful/base_resource.rb:119:in `new'


/home/me/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/contentful-2.16.1/lib/contentful/base_resource.rb:12:in `initialize': undefined method `key?' for <Contentful::Link id='ctf-workflows-tag-rWaKGoFkOXCWTIRZPpIbX'>:Contentful::Link (NoMethodError)

Versions

middleman 4.3.11 contentful_middleman: 4.2.0 OS: Ubuntu 20.04

config.rb

activate :contentful do |f|
  f.space         = { site: ENV['CONTENTFUL_SPACE_ID'] }
  f.access_token  = ENV['CONTENTFUL_DELIVERY_TOKEN']
  f.content_types = {pages: "page", navs: "navigation"}
end

colinbull avatar Jul 01 '21 22:07 colinbull

After further experimentation I can confirm that this is to do with the use of contentful release. It adds a tag to any content that represents the current step in the workflow. Upon removing this tag it works. While I'm now unblocked, I'll still leave this issue open as I believe this is still a bug.

colinbull avatar Jul 01 '21 22:07 colinbull