pact-foundation / pact-ruby

Enables consumer driven contract testing, providing a mock service and DSL for the consumer project, and interaction playback and verification for the service provider project.
https://pact.io
MIT License
2.17k stars 216 forks source link

undefined method `href' for nil:NilClass (NoMethodError) #296

Closed id-ilych closed 1 year ago

id-ilych commented 1 year ago

Hello :wave:

pact (1.63.0)

Probably my pact broker was overloaded and thus publish request ended up with 502/503 response. But that is not the issue, the issue is that it later caused not very helpful error:

/home/containeruser/.bundle/ruby/3.2.0/gems/pact-1.63.0/lib/pact/provider/verification_results/publish.rb:63:in `hacky_tag_url': undefined method `href' for nil:NilClass (NoMethodError)

hacky_tag_url = provider_entity._link('self').href + "/versions/{version}/tags/{tag}"
^^^^^
from /home/user/.bundle/ruby/3.2.0/gems/pact-1.63.0/lib/pact/provider/verification_results/publish.rb:99:in `tag_versions'
from /home/user/.bundle/ruby/3.2.0/gems/pact-1.63.0/lib/pact/provider/verification_results/publish.rb:70:in `tag_versions_if_configured'
from /home/user/.bundle/ruby/3.2.0/gems/pact-1.63.0/lib/pact/provider/verification_results/publish.rb:36:in `call'
from /home/user/.bundle/ruby/3.2.0/gems/pact-1.63.0/lib/pact/provider/verification_results/publish.rb:22:in `call'
from /home/user/.bundle/ruby/3.2.0/gems/pact-1.63.0/lib/pact/provider/verification_results/publish_all.rb:23:in `block in call'
from /home/user/.bundle/ruby/3.2.0/gems/pact-1.63.0/lib/pact/provider/verification_results/publish_all.rb:20:in `collect'
from /home/user/.bundle/ruby/3.2.0/gems/pact-1.63.0/lib/pact/provider/verification_results/publish_all.rb:20:in `call'
from /home/user/.bundle/ruby/3.2.0/gems/pact-1.63.0/lib/pact/provider/verification_results/publish_all.rb:10:in `call'
from /home/user/.bundle/ruby/3.2.0/gems/pact-1.63.0/lib/pact/provider/rspec/pact_broker_formatter.rb:28:in `close'
from /home/user/.bundle/ruby/3.2.0/gems/rspec-core-3.12.1/lib/rspec/core/reporter.rb:209:in `block in notify'
from /home/user/.bundle/ruby/3.2.0/gems/rspec-core-3.12.1/lib/rspec/core/reporter.rb:208:in `each'
from /home/user/.bundle/ruby/3.2.0/gems/rspec-core-3.12.1/lib/rspec/core/reporter.rb:208:in `notify'
from /home/user/.bundle/ruby/3.2.0/gems/rspec-core-3.12.1/lib/rspec/core/reporter.rb:243:in `close'
from /home/user/.bundle/ruby/3.2.0/gems/rspec-core-3.12.1/lib/rspec/core/reporter.rb:196:in `close_after'
from /home/user/.bundle/ruby/3.2.0/gems/rspec-core-3.12.1/lib/rspec/core/reporter.rb:174:in `finish'
from /home/user/.bundle/ruby/3.2.0/gems/rspec-core-3.12.1/lib/rspec/core/reporter.rb:76:in `report'
from /home/user/.bundle/ruby/3.2.0/gems/rspec-core-3.12.1/lib/rspec/core/runner.rb:115:in `run_specs'
from /home/user/.bundle/ruby/3.2.0/gems/rspec-core-3.12.1/lib/rspec/core/runner.rb:89:in `run'
from /home/user/.bundle/ruby/3.2.0/gems/rspec-core-3.12.1/lib/rspec/core/runner.rb:71:in `run'
from /home/user/.bundle/ruby/3.2.0/gems/pact-1.63.0/lib/pact/provider/pact_spec_runner.rb:92:in `run_specs'
from /home/user/.bundle/ruby/3.2.0/gems/pact-1.63.0/lib/pact/provider/pact_spec_runner.rb:36:in `run'
from /home/user/.bundle/ruby/3.2.0/gems/pact-1.63.0/lib/pact/cli/run_pact_verification.rb:76:in `run_with_configured_pacts_from_pact_helper'
from /home/user/.bundle/ruby/3.2.0/gems/pact-1.63.0/lib/pact/cli/run_pact_verification.rb:53:in `run_specs'
from /home/user/.bundle/ruby/3.2.0/gems/pact-1.63.0/lib/pact/cli/run_pact_verification.rb:21:in `call'
from /home/user/.bundle/ruby/3.2.0/gems/pact-1.63.0/lib/pact/cli/run_pact_verification.rb:13:in `call'
from /home/user/.bundle/ruby/3.2.0/gems/pact-1.63.0/lib/pact/cli.rb:32:in `verify'
from /home/user/.bundle/ruby/3.2.0/gems/thor-1.2.1/lib/thor/command.rb:27:in `run'
from /home/user/.bundle/ruby/3.2.0/gems/thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command'
from /home/user/.bundle/ruby/3.2.0/gems/thor-1.2.1/lib/thor.rb:392:in `dispatch'
from /home/user/.bundle/ruby/3.2.0/gems/thor-1.2.1/lib/thor/base.rb:485:in `start'
from /home/user/.bundle/ruby/3.2.0/gems/pact-1.63.0/bin/pact:4:in `'
from /home/user/.bundle/ruby/3.2.0/bin/pact:25:in `load'
from /home/user/.bundle/ruby/3.2.0/bin/pact:25:in `

I assume that success? or assert_success! is missing somewhere.