You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Newbie Ruby developer, I am trying to add a custom github webhook listener to shipit. I have modified by environments/development.rb and added the following lines
Shipit::Webhooks.register_handler('issue_comment') do |params| puts "Webhook Calling issue_comment" end
I end up with the following error message on start
rake aborted! NameError: uninitialized constant Handlers /usr/local/bundle/gems/shipit-engine-0.31.0/app/models/shipit/webhooks.rb:6:indefault_handlers'
/usr/local/bundle/gems/shipit-engine-0.31.0/app/models/shipit/webhooks.rb:18:in reset_handlers!' /usr/local/bundle/gems/shipit-engine-0.31.0/app/models/shipit/webhooks.rb:14:in handlers'
/usr/local/bundle/gems/shipit-engine-0.31.0/app/models/shipit/webhooks.rb:22:in register_handler' /var/shipit/config/environments/development.rb:65:in block in <top (required)>'
/usr/local/bundle/gems/railties-6.0.2.1/lib/rails/railtie.rb:216:in instance_eval' /usr/local/bundle/gems/railties-6.0.2.1/lib/rails/railtie.rb:216:in configure'
/var/shipit/config/environments/development.rb:1:in <top (required)>' /usr/local/bundle/gems/railties-6.0.2.1/lib/rails/engine.rb:612:in block (2 levels) in class:Engine'
/usr/local/bundle/gems/railties-6.0.2.1/lib/rails/engine.rb:611:in each' /usr/local/bundle/gems/railties-6.0.2.1/lib/rails/engine.rb:611:in block in class:Engine'
/usr/local/bundle/gems/railties-6.0.2.1/lib/rails/initializable.rb:32:in instance_exec' /usr/local/bundle/gems/railties-6.0.2.1/lib/rails/initializable.rb:32:in run'
/usr/local/bundle/gems/railties-6.0.2.1/lib/rails/initializable.rb:61:in block in run_initializers' /usr/local/bundle/gems/railties-6.0.2.1/lib/rails/initializable.rb:50:in each'
/usr/local/bundle/gems/railties-6.0.2.1/lib/rails/initializable.rb:50:in tsort_each_child' /usr/local/bundle/gems/railties-6.0.2.1/lib/rails/initializable.rb:60:in run_initializers'
/usr/local/bundle/gems/railties-6.0.2.1/lib/rails/application.rb:363:in initialize!' /var/shipit/config/environment.rb:5:in <top (required)>'
/usr/local/bundle/gems/railties-6.0.2.1/lib/rails/application.rb:339:in require_environment!' /usr/local/bundle/gems/railties-6.0.2.1/lib/rails/application.rb:515:in block in run_tasks_blocks'
Tasks: TOP => railties:install:migrations => db:load_config => environment
(See full trace by running task with --trace)
`
Any assistance would be greatly appreciated.
The text was updated successfully, but these errors were encountered:
Hi, this happens because the register happens too early in the application initialization cycle. To fix this the register_handler should be in a to_prepare callback:
Hello,
Newbie Ruby developer, I am trying to add a custom github webhook listener to shipit. I have modified by environments/development.rb and added the following lines
Shipit::Webhooks.register_handler('issue_comment') do |params| puts "Webhook Calling issue_comment" end
I end up with the following error message on start
rake aborted! NameError: uninitialized constant Handlers /usr/local/bundle/gems/shipit-engine-0.31.0/app/models/shipit/webhooks.rb:6:in
default_handlers'/usr/local/bundle/gems/shipit-engine-0.31.0/app/models/shipit/webhooks.rb:18:in
reset_handlers!' /usr/local/bundle/gems/shipit-engine-0.31.0/app/models/shipit/webhooks.rb:14:in
handlers'/usr/local/bundle/gems/shipit-engine-0.31.0/app/models/shipit/webhooks.rb:22:in
register_handler' /var/shipit/config/environments/development.rb:65:in
block in <top (required)>'/usr/local/bundle/gems/railties-6.0.2.1/lib/rails/railtie.rb:216:in
instance_eval' /usr/local/bundle/gems/railties-6.0.2.1/lib/rails/railtie.rb:216:in
configure'/var/shipit/config/environments/development.rb:1:in
<top (required)>' /usr/local/bundle/gems/railties-6.0.2.1/lib/rails/engine.rb:612:in
block (2 levels) in class:Engine'/usr/local/bundle/gems/railties-6.0.2.1/lib/rails/engine.rb:611:in
each' /usr/local/bundle/gems/railties-6.0.2.1/lib/rails/engine.rb:611:in
block in class:Engine'/usr/local/bundle/gems/railties-6.0.2.1/lib/rails/initializable.rb:32:in
instance_exec' /usr/local/bundle/gems/railties-6.0.2.1/lib/rails/initializable.rb:32:in
run'/usr/local/bundle/gems/railties-6.0.2.1/lib/rails/initializable.rb:61:in
block in run_initializers' /usr/local/bundle/gems/railties-6.0.2.1/lib/rails/initializable.rb:50:in
each'/usr/local/bundle/gems/railties-6.0.2.1/lib/rails/initializable.rb:50:in
tsort_each_child' /usr/local/bundle/gems/railties-6.0.2.1/lib/rails/initializable.rb:60:in
run_initializers'/usr/local/bundle/gems/railties-6.0.2.1/lib/rails/application.rb:363:in
initialize!' /var/shipit/config/environment.rb:5:in
<top (required)>'/usr/local/bundle/gems/railties-6.0.2.1/lib/rails/application.rb:339:in
require_environment!' /usr/local/bundle/gems/railties-6.0.2.1/lib/rails/application.rb:515:in
block in run_tasks_blocks'Tasks: TOP => railties:install:migrations => db:load_config => environment
(See full trace by running task with --trace)
`
Any assistance would be greatly appreciated.
The text was updated successfully, but these errors were encountered: