pronto icon indicating copy to clipboard operation
pronto copied to clipboard

Error while configuring with bitbucket

Open sunasra opened this issue 7 years ago • 5 comments

in .pronto.yml

all: exclude: - 'spec/**/*' # exclude files for single runner bitbucket: slug: username/repo username: [email protected] password: xxxxxxx web_endpoint: https://bitbucket.org/ max_warnings: 150 `verbose: true``

running this command in local bundle exec pronto run -f bitbucket_pr -c origin/<branch_name>

throws this error

/Users/abcuser/.rvm/gems/ruby-2.1.6/gems/pronto-0.9.5/lib/pronto/clients/bitbucket_client.rb:26:in `pull_requests': undefined method `[]' for nil:NilClass (NoMethodError)
	from /Users/abcuser/.rvm/gems/ruby-2.1.6/gems/pronto-0.9.5/lib/pronto/bitbucket.rb:68:in `pull_requests'
	from /Users/abcuser/.rvm/gems/ruby-2.1.6/gems/pronto-0.9.5/lib/pronto/bitbucket.rb:61:in `pull'
	from /Users/abcuser/.rvm/gems/ruby-2.1.6/gems/pronto-0.9.5/lib/pronto/bitbucket.rb:54:in `pull_id'
	from /Users/abcuser/.rvm/gems/ruby-2.1.6/gems/pronto-0.9.5/lib/pronto/bitbucket.rb:4:in `pull_comments'
	from /Users/abcuser/.rvm/gems/ruby-2.1.6/gems/pronto-0.9.5/lib/pronto/formatter/pull_request_formatter.rb:6:in `existing_comments'
	from /Users/abcuser/.rvm/gems/ruby-2.1.6/gems/pronto-0.9.5/lib/pronto/formatter/git_formatter.rb:6:in `format'
	from /Users/abcuser/.rvm/gems/ruby-2.1.6/gems/pronto-0.9.5/lib/pronto.rb:67:in `block in run'
	from /Users/abcuser/.rvm/gems/ruby-2.1.6/gems/pronto-0.9.5/lib/pronto.rb:66:in `each'
	from /Users/abcuser/.rvm/gems/ruby-2.1.6/gems/pronto-0.9.5/lib/pronto.rb:66:in `run'
	from /Users/abcuser/.rvm/gems/ruby-2.1.6/gems/pronto-0.9.5/lib/pronto/cli.rb:61:in `block in run'
	from /Users/abcuser/.rvm/gems/ruby-2.1.6/gems/pronto-0.9.5/lib/pronto/cli.rb:60:in `chdir'
	from /Users/abcuser/.rvm/gems/ruby-2.1.6/gems/pronto-0.9.5/lib/pronto/cli.rb:60:in `run'
	from /Users/abcuser/.rvm/gems/ruby-2.1.6/gems/thor-0.19.4/lib/thor/command.rb:27:in `run'
	from /Users/abcuser/.rvm/gems/ruby-2.1.6/gems/thor-0.19.4/lib/thor/invocation.rb:126:in `invoke_command'
	from /Users/abcuser/.rvm/gems/ruby-2.1.6/gems/thor-0.19.4/lib/thor.rb:369:in `dispatch'
	from /Users/abcuser/.rvm/gems/ruby-2.1.6/gems/thor-0.19.4/lib/thor/base.rb:444:in `start'
	from /Users/abcuser/.rvm/gems/ruby-2.1.6/gems/pronto-0.9.5/bin/pronto:6:in `<top (required)>'
	from /Users/abcuser/.rvm/gems/ruby-2.1.6/bin/pronto:23:in `load'
	from /Users/abcuser/.rvm/gems/ruby-2.1.6/bin/pronto:23:in `<main>'
	from /Users/abcuser/.rvm/gems/ruby-2.1.6/bin/ruby_executable_hooks:15:in `eval'
	from /Users/abcuser/.rvm/gems/ruby-2.1.6/bin/ruby_executable_hooks:15:in `<main>'

Can anyone let me know what is issue here

sunasra avatar Sep 21 '17 19:09 sunasra

@sunasra hey, thanks for reporting the issue. It might be a bug with Pronto not handling zero open pull requests. At the time of running the script, did you have any pull requests open?

mmozuras avatar Oct 15 '17 20:10 mmozuras

@mmozuras Thanks for Reply. Pull request is open for branch passed in command. i.e bundle exec pronto run -f bitbucket_pr -c origin/<branch_name>

sunasra avatar Oct 17 '17 16:10 sunasra

I am getting this error now cc @mmozuras

`/Users/abcuser/.rvm/gems/ruby-2.1.6/gems/pronto-0.9.5/lib/pronto/clients/bitbucket_client.rb:36:in `openstruct': undefined method `map' for #<String:0x007fa05ba3f888> (NoMethodError)
	from /Users/abcuser/.rvm/gems/ruby-2.1.6/gems/pronto-0.9.5/lib/pronto/clients/bitbucket_client.rb:20:in `pull_comments'
	from /Users/abcuser/.rvm/gems/ruby-2.1.6/gems/pronto-0.9.5/lib/pronto/bitbucket.rb:5:in `pull_comments'
	from /Users/abcuser/.rvm/gems/ruby-2.1.6/gems/pronto-0.9.5/lib/pronto/formatter/pull_request_formatter.rb:6:in `existing_comments'
	from /Users/abcuser/.rvm/gems/ruby-2.1.6/gems/pronto-0.9.5/lib/pronto/formatter/git_formatter.rb:6:in `format'
	from /Users/abcuser/.rvm/gems/ruby-2.1.6/gems/pronto-0.9.5/lib/pronto.rb:67:in `block in run'
	from /Users/abcuser/.rvm/gems/ruby-2.1.6/gems/pronto-0.9.5/lib/pronto.rb:66:in `each'
	from /Users/abcuser/.rvm/gems/ruby-2.1.6/gems/pronto-0.9.5/lib/pronto.rb:66:in `run'
	from /Users/abcuser/.rvm/gems/ruby-2.1.6/gems/pronto-0.9.5/lib/pronto/cli.rb:61:in `block in run'
	from /Users/abcuser/.rvm/gems/ruby-2.1.6/gems/pronto-0.9.5/lib/pronto/cli.rb:60:in `chdir'
	from /Users/abcuser/.rvm/gems/ruby-2.1.6/gems/pronto-0.9.5/lib/pronto/cli.rb:60:in `run'
	from /Users/abcuser/.rvm/gems/ruby-2.1.6/gems/thor-0.19.4/lib/thor/command.rb:27:in `run'
	from /Users/abcuser/.rvm/gems/ruby-2.1.6/gems/thor-0.19.4/lib/thor/invocation.rb:126:in `invoke_command'
	from /Users/abcuser/.rvm/gems/ruby-2.1.6/gems/thor-0.19.4/lib/thor.rb:369:in `dispatch'
	from /Users/abcuser/.rvm/gems/ruby-2.1.6/gems/thor-0.19.4/lib/thor/base.rb:444:in `start'
	from /Users/abcuser/.rvm/gems/ruby-2.1.6/gems/pronto-0.9.5/bin/pronto:6:in `<top (required)>'
	from /Users/abcuser/.rvm/gems/ruby-2.1.6/bin/pronto:23:in `load'
	from /Users/abcuser/.rvm/gems/ruby-2.1.6/bin/pronto:23:in `<main>'
	from /Users/abcuser/.rvm/gems/ruby-2.1.6/bin/ruby_executable_hooks:15:in `eval'
	from /Users/abcuser/.rvm/gems/ruby-2.1.6/bin/ruby_executable_hooks:15:in `<main>'`

sunasra avatar Oct 19 '17 16:10 sunasra

@sunasra I can't reproduce it myself. Could you logging to BitbucketClient or use something like pry to inspect the response?

This is the code we're interested in:

class BitbucketClient
  # ...

  def pull_requests(slug)
    base = 'https://api.bitbucket.org/2.0/repositories'
    response = get("#{base}/#{slug}/pullrequests?state=OPEN")
    openstruct(response['values'])
  end

 # ...
end

mmozuras avatar Oct 20 '17 19:10 mmozuras

Hi,

running into the same issue... 🙈

You can reproduce it with your account password, but you need to create an app password... https://developer.atlassian.com/bitbucket/api/2/reference/meta/authentication#basic-auth

This issue can be closed.

matt-hh avatar Oct 11 '18 08:10 matt-hh