Skip to content
This repository has been archived by the owner on Jan 29, 2022. It is now read-only.

NoMethodError at /payload with Bitbucket Server 7.4 webhook #134

Open
Esras opened this issue Jul 16, 2020 · 1 comment
Open

NoMethodError at /payload with Bitbucket Server 7.4 webhook #134

Esras opened this issue Jul 16, 2020 · 1 comment
Labels

Comments

@Esras
Copy link

Esras commented Jul 16, 2020

Hello,

With an install of puppet-webhook 2.1.1 on CentOS 7, I am getting the following error when Bitbucket Server 7.4 (upgraded just to check, this was also failing on 6.10):

Jul 16 12:56:42 <hostname> bundle[84997]: 2020-07-16 12:56:42 - NoMethodError - undefined method `deleted' for nil:NilClass:                                                                                                                                                              
Jul 16 12:56:42 <hostname> bundle[84997]: /opt/voxpupuli/webhook/app/controllers/api/v1/r10k/environment_controller.rb:59:in `get_branch'                                                                                                                                                 
Jul 16 12:56:42 <hostname> bundle[84997]: /opt/voxpupuli/webhook/app/controllers/api/v1/r10k/environment_controller.rb:14:in `block in <class:EnvironmentController>'                                                                                                                     
Jul 16 12:56:42 <hostname> bundle[84997]: /opt/voxpupuli/webhook/lib/ruby/gems/2.6.0/gems/sinatra-2.0.8.1/lib/sinatra/base.rb:1636:in `call'                                                                                                                                              
Jul 16 12:56:42 <hostname> bundle[84997]: /opt/voxpupuli/webhook/lib/ruby/gems/2.6.0/gems/sinatra-2.0.8.1/lib/sinatra/base.rb:1636:in `block in compile!'                                                                                                                                 
Jul 16 12:56:42 <hostname> bundle[84997]: /opt/voxpupuli/webhook/lib/ruby/gems/2.6.0/gems/sinatra-2.0.8.1/lib/sinatra/base.rb:987:in `block (3 levels) in route!'                                                                                                                         
Jul 16 12:56:42 <hostname> bundle[84997]: /opt/voxpupuli/webhook/lib/ruby/gems/2.6.0/gems/sinatra-2.0.8.1/lib/sinatra/base.rb:1006:in `route_eval'                                                                                                                                        
Jul 16 12:56:42 <hostname> bundle[84997]: /opt/voxpupuli/webhook/lib/ruby/gems/2.6.0/gems/sinatra-2.0.8.1/lib/sinatra/base.rb:987:in `block (2 levels) in route!'                                                                                                                         
Jul 16 12:56:42 <hostname> bundle[84997]: /opt/voxpupuli/webhook/lib/ruby/gems/2.6.0/gems/sinatra-2.0.8.1/lib/sinatra/base.rb:1035:in `block in process_route'                                                                                                                            
Jul 16 12:56:42 <hostname> bundle[84997]: /opt/voxpupuli/webhook/lib/ruby/gems/2.6.0/gems/sinatra-2.0.8.1/lib/sinatra/base.rb:1033:in `catch'                                                                                                                                             
Jul 16 12:56:42 <hostname> bundle[84997]: /opt/voxpupuli/webhook/lib/ruby/gems/2.6.0/gems/sinatra-2.0.8.1/lib/sinatra/base.rb:1033:in `process_route'                                                                                                                                     
Jul 16 12:56:42 <hostname> bundle[84997]: /opt/voxpupuli/webhook/lib/ruby/gems/2.6.0/gems/sinatra-2.0.8.1/lib/sinatra/base.rb:985:in `block in route!'
Jul 16 12:56:42 <hostname> bundle[84997]: /opt/voxpupuli/webhook/lib/ruby/gems/2.6.0/gems/sinatra-2.0.8.1/lib/sinatra/base.rb:984:in `each'
Jul 16 12:56:42 <hostname> bundle[84997]: /opt/voxpupuli/webhook/lib/ruby/gems/2.6.0/gems/sinatra-2.0.8.1/lib/sinatra/base.rb:984:in `route!'
Jul 16 12:56:42 <hostname> bundle[84997]: /opt/voxpupuli/webhook/lib/ruby/gems/2.6.0/gems/sinatra-2.0.8.1/lib/sinatra/base.rb:1098:in `block in dispatch!'
Jul 16 12:56:42 <hostname> bundle[84997]: /opt/voxpupuli/webhook/lib/ruby/gems/2.6.0/gems/sinatra-2.0.8.1/lib/sinatra/base.rb:1072:in `block in invoke'
Jul 16 12:56:42 <hostname> bundle[84997]: /opt/voxpupuli/webhook/lib/ruby/gems/2.6.0/gems/sinatra-2.0.8.1/lib/sinatra/base.rb:1072:in `catch'
Jul 16 12:56:42 <hostname> bundle[84997]: /opt/voxpupuli/webhook/lib/ruby/gems/2.6.0/gems/sinatra-2.0.8.1/lib/sinatra/base.rb:1072:in `invoke'
Jul 16 12:56:42 <hostname> bundle[84997]: /opt/voxpupuli/webhook/lib/ruby/gems/2.6.0/gems/sinatra-2.0.8.1/lib/sinatra/base.rb:1095:in `dispatch!'
Jul 16 12:56:42 <hostname> bundle[84997]: /opt/voxpupuli/webhook/lib/ruby/gems/2.6.0/gems/sinatra-2.0.8.1/lib/sinatra/base.rb:919:in `block in call!'
Jul 16 12:56:42 <hostname> bundle[84997]: /opt/voxpupuli/webhook/lib/ruby/gems/2.6.0/gems/sinatra-2.0.8.1/lib/sinatra/base.rb:1072:in `block in invoke'
Jul 16 12:56:42 <hostname> bundle[84997]: /opt/voxpupuli/webhook/lib/ruby/gems/2.6.0/gems/sinatra-2.0.8.1/lib/sinatra/base.rb:1072:in `catch'
Jul 16 12:56:42 <hostname> bundle[84997]: /opt/voxpupuli/webhook/lib/ruby/gems/2.6.0/gems/sinatra-2.0.8.1/lib/sinatra/base.rb:1072:in `invoke'
Jul 16 12:56:42 <hostname> bundle[84997]: /opt/voxpupuli/webhook/lib/ruby/gems/2.6.0/gems/sinatra-2.0.8.1/lib/sinatra/base.rb:919:in `call!'
Jul 16 12:56:42 <hostname> bundle[84997]: /opt/voxpupuli/webhook/lib/ruby/gems/2.6.0/gems/sinatra-2.0.8.1/lib/sinatra/base.rb:908:in `call'
Jul 16 12:56:42 <hostname> bundle[84997]: /opt/voxpupuli/webhook/lib/ruby/gems/2.6.0/gems/rack-protection-2.0.8.1/lib/rack/protection/xss_header.rb:18:in `call'
Jul 16 12:56:42 <hostname> bundle[84997]: /opt/voxpupuli/webhook/lib/ruby/gems/2.6.0/gems/rack-protection-2.0.8.1/lib/rack/protection/path_traversal.rb:16:in `call'
Jul 16 12:56:42 <hostname> bundle[84997]: /opt/voxpupuli/webhook/lib/ruby/gems/2.6.0/gems/rack-protection-2.0.8.1/lib/rack/protection/json_csrf.rb:26:in `call'
Jul 16 12:56:42 <hostname> bundle[84997]: /opt/voxpupuli/webhook/lib/ruby/gems/2.6.0/gems/rack-protection-2.0.8.1/lib/rack/protection/base.rb:50:in `call'
Jul 16 12:56:42 <hostname> bundle[84997]: /opt/voxpupuli/webhook/lib/ruby/gems/2.6.0/gems/rack-protection-2.0.8.1/lib/rack/protection/base.rb:50:in `call'
Jul 16 12:56:42 <hostname> bundle[84997]: /opt/voxpupuli/webhook/lib/ruby/gems/2.6.0/gems/rack-protection-2.0.8.1/lib/rack/protection/frame_options.rb:31:in `call'
Jul 16 12:56:42 <hostname> bundle[84997]: /opt/voxpupuli/webhook/lib/ruby/gems/2.6.0/gems/rack-2.0.8/lib/rack/null_logger.rb:9:in `call'
Jul 16 12:56:42 <hostname> bundle[84997]: /opt/voxpupuli/webhook/lib/ruby/gems/2.6.0/gems/rack-2.0.8/lib/rack/head.rb:12:in `call'
Jul 16 12:56:42 <hostname> bundle[84997]: /opt/voxpupuli/webhook/lib/ruby/gems/2.6.0/gems/sinatra-2.0.8.1/lib/sinatra/show_exceptions.rb:22:in `call'
Jul 16 12:56:42 <hostname> bundle[84997]: /opt/voxpupuli/webhook/lib/ruby/gems/2.6.0/gems/sinatra-2.0.8.1/lib/sinatra/base.rb:194:in `call'
Jul 16 12:56:42 <hostname> bundle[84997]: /opt/voxpupuli/webhook/lib/ruby/gems/2.6.0/gems/sinatra-2.0.8.1/lib/sinatra/base.rb:1951:in `call'
Jul 16 12:56:42 <hostname> bundle[84997]: /opt/voxpupuli/webhook/lib/ruby/gems/2.6.0/gems/sinatra-2.0.8.1/lib/sinatra/base.rb:966:in `forward'
Jul 16 12:56:42 <hostname> bundle[84997]: /opt/voxpupuli/webhook/lib/ruby/gems/2.6.0/gems/sinatra-2.0.8.1/lib/sinatra/base.rb:1052:in `route_missing'
Jul 16 12:56:42 <hostname> bundle[84997]: /opt/voxpupuli/webhook/lib/ruby/gems/2.6.0/gems/sinatra-2.0.8.1/lib/sinatra/base.rb:997:in `route!'
Jul 16 12:56:42 <hostname> bundle[84997]: /opt/voxpupuli/webhook/lib/ruby/gems/2.6.0/gems/sinatra-2.0.8.1/lib/sinatra/base.rb:1001:in `route!'
Jul 16 12:56:42 <hostname> bundle[84997]: /opt/voxpupuli/webhook/lib/ruby/gems/2.6.0/gems/sinatra-2.0.8.1/lib/sinatra/base.rb:997:in `route!'
Jul 16 12:56:42 <hostname> bundle[84997]: /opt/voxpupuli/webhook/lib/ruby/gems/2.6.0/gems/sinatra-2.0.8.1/lib/sinatra/base.rb:1098:in `block in dispatch!'
Jul 16 12:56:42 <hostname> bundle[84997]: /opt/voxpupuli/webhook/lib/ruby/gems/2.6.0/gems/sinatra-2.0.8.1/lib/sinatra/base.rb:1072:in `block in invoke'
Jul 16 12:56:42 <hostname> bundle[84997]: /opt/voxpupuli/webhook/lib/ruby/gems/2.6.0/gems/sinatra-2.0.8.1/lib/sinatra/base.rb:1072:in `catch'
Jul 16 12:56:42 <hostname> bundle[84997]: /opt/voxpupuli/webhook/lib/ruby/gems/2.6.0/gems/sinatra-2.0.8.1/lib/sinatra/base.rb:1072:in `invoke'
Jul 16 12:56:42 <hostname> bundle[84997]: /opt/voxpupuli/webhook/lib/ruby/gems/2.6.0/gems/sinatra-2.0.8.1/lib/sinatra/base.rb:1095:in `dispatch!'
Jul 16 12:56:42 <hostname> bundle[84997]: /opt/voxpupuli/webhook/lib/ruby/gems/2.6.0/gems/sinatra-2.0.8.1/lib/sinatra/base.rb:919:in `block in call!'
Jul 16 12:56:42 <hostname> bundle[84997]: /opt/voxpupuli/webhook/lib/ruby/gems/2.6.0/gems/sinatra-2.0.8.1/lib/sinatra/base.rb:1072:in `block in invoke'
Jul 16 12:56:42 <hostname> bundle[84997]: /opt/voxpupuli/webhook/lib/ruby/gems/2.6.0/gems/sinatra-2.0.8.1/lib/sinatra/base.rb:1072:in `catch'
Jul 16 12:56:42 <hostname> bundle[84997]: /opt/voxpupuli/webhook/lib/ruby/gems/2.6.0/gems/sinatra-2.0.8.1/lib/sinatra/base.rb:1072:in `invoke'
Jul 16 12:56:42 <hostname> bundle[84997]: /opt/voxpupuli/webhook/lib/ruby/gems/2.6.0/gems/sinatra-2.0.8.1/lib/sinatra/base.rb:919:in `call!'
Jul 16 12:56:42 <hostname> bundle[84997]: /opt/voxpupuli/webhook/lib/ruby/gems/2.6.0/gems/sinatra-2.0.8.1/lib/sinatra/base.rb:908:in `call'
Jul 16 12:56:42 <hostname> bundle[84997]: /opt/voxpupuli/webhook/lib/ruby/gems/2.6.0/gems/warden-1.2.8/lib/warden/manager.rb:36:in `block in call'
Jul 16 12:56:42 <hostname> bundle[84997]: /opt/voxpupuli/webhook/lib/ruby/gems/2.6.0/gems/warden-1.2.8/lib/warden/manager.rb:34:in `catch'
Jul 16 12:56:42 <hostname> bundle[84997]: /opt/voxpupuli/webhook/lib/ruby/gems/2.6.0/gems/warden-1.2.8/lib/warden/manager.rb:34:in `call'
Jul 16 12:56:42 <hostname> bundle[84997]: /opt/voxpupuli/webhook/lib/ruby/gems/2.6.0/gems/rack-protection-2.0.8.1/lib/rack/protection/xss_header.rb:18:in `call'
Jul 16 12:56:42 <hostname> bundle[84997]: /opt/voxpupuli/webhook/lib/ruby/gems/2.6.0/gems/rack-protection-2.0.8.1/lib/rack/protection/path_traversal.rb:16:in `call'
Jul 16 12:56:42 <hostname> bundle[84997]: /opt/voxpupuli/webhook/lib/ruby/gems/2.6.0/gems/rack-protection-2.0.8.1/lib/rack/protection/json_csrf.rb:26:in `call'
Jul 16 12:56:42 <hostname> bundle[84997]: /opt/voxpupuli/webhook/lib/ruby/gems/2.6.0/gems/rack-protection-2.0.8.1/lib/rack/protection/base.rb:50:in `call'
Jul 16 12:56:42 <hostname> bundle[84997]: /opt/voxpupuli/webhook/lib/ruby/gems/2.6.0/gems/rack-protection-2.0.8.1/lib/rack/protection/base.rb:50:in `call'
Jul 16 12:56:42 <hostname> bundle[84997]: /opt/voxpupuli/webhook/lib/ruby/gems/2.6.0/gems/rack-protection-2.0.8.1/lib/rack/protection/frame_options.rb:31:in `call'
Jul 16 12:56:42 <hostname> bundle[84997]: /opt/voxpupuli/webhook/lib/ruby/gems/2.6.0/gems/rack-2.0.8/lib/rack/null_logger.rb:9:in `call'
Jul 16 12:56:42 <hostname> bundle[84997]: /opt/voxpupuli/webhook/lib/ruby/gems/2.6.0/gems/rack-2.0.8/lib/rack/head.rb:12:in `call'
Jul 16 12:56:42 <hostname> bundle[84997]: /opt/voxpupuli/webhook/lib/ruby/gems/2.6.0/gems/sinatra-2.0.8.1/lib/sinatra/show_exceptions.rb:22:in `call'
Jul 16 12:56:42 <hostname> bundle[84997]: /opt/voxpupuli/webhook/lib/ruby/gems/2.6.0/gems/sinatra-2.0.8.1/lib/sinatra/base.rb:194:in `call'
Jul 16 12:56:42 <hostname> bundle[84997]: /opt/voxpupuli/webhook/lib/ruby/gems/2.6.0/gems/sinatra-2.0.8.1/lib/sinatra/base.rb:1951:in `call'
Jul 16 12:56:42 <hostname> bundle[84997]: /opt/voxpupuli/webhook/lib/ruby/gems/2.6.0/gems/rack-2.0.8/lib/rack/urlmap.rb:68:in `block in call'
Jul 16 12:56:42 <hostname> bundle[84997]: /opt/voxpupuli/webhook/lib/ruby/gems/2.6.0/gems/rack-2.0.8/lib/rack/urlmap.rb:53:in `each'
Jul 16 12:56:42 <hostname> bundle[84997]: /opt/voxpupuli/webhook/lib/ruby/gems/2.6.0/gems/rack-2.0.8/lib/rack/urlmap.rb:53:in `call'
Jul 16 12:56:42 <hostname> bundle[84997]: /opt/voxpupuli/webhook/lib/ruby/gems/2.6.0/gems/puma-4.3.5/lib/puma/configuration.rb:228:in `call'
Jul 16 12:56:42 <hostname> bundle[84997]: /opt/voxpupuli/webhook/lib/ruby/gems/2.6.0/gems/puma-4.3.5/lib/puma/server.rb:713:in `handle_request'
Jul 16 12:56:42 <hostname> bundle[84997]: /opt/voxpupuli/webhook/lib/ruby/gems/2.6.0/gems/puma-4.3.5/lib/puma/server.rb:472:in `process_client'
Jul 16 12:56:42 <hostname> bundle[84997]: /opt/voxpupuli/webhook/lib/ruby/gems/2.6.0/gems/puma-4.3.5/lib/puma/server.rb:328:in `block in run'
Jul 16 12:56:42 <hostname> bundle[84997]: /opt/voxpupuli/webhook/lib/ruby/gems/2.6.0/gems/puma-4.3.5/lib/puma/thread_pool.rb:134:in `block in spawn_thread'

I have made the change I referenced in #131, changing the environment to production. If I take the payload that Bitbucket says it sent and send that using curl, it does seem to arrive at at the webhook endpoint.

curl -X POST -H "Content-Type: application/json" -H "X-Request-Id: 27973332-ddc5-466c-a9d4-6d277603f28e" -H "X-Event-Key: repo:refs_changed" -d '{"eventKey":"repo:refs_changed","date":"2020-07-16T20:10:50+0000","actor":{"name":"asdf","emailAddress":"[email protected]","id":52,"displayName":"Asdf","active":true,"slug":"asdf","type":"NORMAL","links":{"self":[{"href":"https://<redacted user link>"}]}},"repository":{"slug":"puppet-control-repo","id":36,"name":"Puppet Control Repo","hierarchyId":"1d2810d27d614aecda49","scmId":"git","state":"AVAILABLE","statusMessage":"Available","forkable":true,"project":{"key":"SOMEKEY","id":1,"name":"Some Name","public":false,"type":"NORMAL","links":{"self":[{"href":"<Link redacted>"}]}},"public":false,"links":{"clone":[{"href":"ssh://git@<Link redacted>/puppet-control-repo.git","name":"ssh"},{"href":"https://<link redacted>/puppet-control-repo.git","name":"http"}],"self":[{"href":"https://<link redacted>/repos/puppet-control-repo/browse"}]}},"changes":[{"ref":{"id":"refs/heads/random_crap","displayId":"random_crap","type":"BRANCH"},"refId":"refs/heads/random_crap","fromHash":"74f3085d0e509107ade95595f094d9598aa0a69f","toHash":"4387a00d00faed6572f6d07422ed852e5004c3ec","type":"UPDATE"}]}' 'http://localhost:9292/payload' -k -q seems to work just fine, though, when run from the host that the server is running on.

Trying to understand what my next debugging step should be - as best I can tell, the data object isn't getting initialized somewhere, but I'm not sure what's different in how BB is sending the webhook.

@dhollinger
Copy link
Member

Could be that Bitbucket changed their webhook json yet again. I know @alexjfisher and I have updated the bitbucket webhook parser multiple times since the start of the project for that very reason. I'll look at it later tonight

@dhollinger dhollinger added the bug label Aug 18, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants