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

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

Open
colinbull opened this issue Jul 1, 2021 · 1 comment

Comments

@colinbull
Copy link

colinbull commented Jul 1, 2021

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

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.

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

No branches or pull requests

1 participant