Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slack Agent Fails - undefined method `gsub' #25

Open
rdoering opened this issue Sep 25, 2018 · 4 comments
Open

Slack Agent Fails - undefined method `gsub' #25

rdoering opened this issue Sep 25, 2018 · 4 comments

Comments

@rdoering
Copy link

rdoering commented Sep 25, 2018

Container image : e53209c1e32a

Exception during receive. undefined method gsub' for nil:NilClass: /app/vendor/bundle/ruby/2.5.0/gems/slack-notifier-1.0.0/lib/slack-notifier/link_formatter.rb:18:in formatted' /app/vendor/bundle..

Here the full Log from Huginn

Exception during receive. undefined method `gsub' for nil:NilClass: /app/vendor/bundle/ruby/2.5.0/gems/slack-notifier-1.0.0/lib/slack-notifier/link_formatter.rb:18:in `formatted'
/app/vendor/bundle/ruby/2.5.0/gems/slack-notifier-1.0.0/lib/slack-notifier/link_formatter.rb:8:in `format'
/app/vendor/bundle/ruby/2.5.0/gems/slack-notifier-1.0.0/lib/slack-notifier.rb:19:in `ping'
/app/app/models/agents/slack_agent.rb:85:in `block in receive'
/app/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.0/lib/active_record/relation/delegation.rb:41:in `each'
/app/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.0/lib/active_record/relation/delegation.rb:41:in `each'
/app/app/models/agents/slack_agent.rb:75:in `receive'
/app/app/jobs/agent_receive_job.rb:8:in `perform'
/app/vendor/bundle/ruby/2.5.0/gems/activejob-5.2.0/lib/active_job/execution.rb:39:in `block in perform_now'
/app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.0/lib/active_support/callbacks.rb:109:in `block in run_callbacks'
/app/vendor/bundle/ruby/2.5.0/gems/i18n-1.0.1/lib/i18n.rb:284:in `with_locale'
/app/vendor/bundle/ruby/2.5.0/gems/activejob-5.2.0/lib/active_job/translation.rb:9:in `block (2 levels) in <module:Translation>'
/app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.0/lib/active_support/callbacks.rb:118:in `instance_exec'
/app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.0/lib/active_support/callbacks.rb:118:in `block in run_callbacks'
/app/vendor/bundle/ruby/2.5.0/gems/activejob-5.2.0/lib/active_job/logging.rb:26:in `block (4 levels) in <module:Logging>'
/app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.0/lib/active_support/notifications.rb:168:in `block in instrument'
/app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.0/lib/active_support/notifications/instrumenter.rb:23:in `instrument'
/app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.0/lib/active_support/notifications.rb:168:in `instrument'
/app/vendor/bundle/ruby/2.5.0/gems/activejob-5.2.0/lib/active_job/logging.rb:25:in `block (3 levels) in <module:Logging>'
/app/vendor/bundle/ruby/2.5.0/gems/activejob-5.2.0/lib/active_job/logging.rb:46:in `block in tag_logger'
/app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.0/lib/active_support/tagged_logging.rb:71:in `block in tagged'
/app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.0/lib/active_support/tagged_logging.rb:28:in `tagged'
/app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.0/lib/active_support/tagged_logging.rb:71:in `tagged'
/app/vendor/bundle/ruby/2.5.0/gems/activejob-5.2.0/lib/active_job/logging.rb:46:in `tag_logger'
/app/vendor/bundle/ruby/2.5.0/gems/activejob-5.2.0/lib/active_job/logging.rb:22:in `block (2 levels) in <module:Logging>'
/app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.0/lib/active_support/callbacks.rb:118:in `instance_exec'
/app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.0/lib/active_support/callbacks.rb:118:in `block in run_callbacks'
/app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.0/lib/active_support/callbacks.rb:136:in `run_callbacks'
/app/vendor/bundle/ruby/2.5.0/gems/activejob-5.2.0/lib/active_job/execution.rb:35:in `perform_now'
/app/vendor/bundle/ruby/2.5.0/gems/activejob-5.2.0/lib/active_job/execution.rb:24:in `block in execute'
/app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.0/lib/active_support/callbacks.rb:109:in `block in run_callbacks'
/app/vendor/bundle/ruby/2.5.0/gems/activejob-5.2.0/lib/active_job/railtie.rb:28:in `block (4 levels) in <class:Railtie>'
/app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.0/lib/active_support/execution_wrapper.rb:87:in `wrap'
/app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.0/lib/active_support/reloader.rb:73:in `block in wrap'
/app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.0/lib/active_support/execution_wrapper.rb:87:in `wrap'
/app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.0/lib/active_support/reloader.rb:72:in `wrap'
/app/vendor/bundle/ruby/2.5.0/gems/activejob-5.2.0/lib/active_job/railtie.rb:27:in `block (3 levels) in <class:Railtie>'
/app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.0/lib/active_support/callbacks.rb:118:in `instance_exec'
/app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.0/lib/active_support/callbacks.rb:118:in `block in run_callbacks'
/app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.0/lib/active_support/callbacks.rb:136:in `run_callbacks'
/app/vendor/bundle/ruby/2.5.0/gems/activejob-5.2.0/lib/active_job/execution.rb:22:in `execute'
/app/vendor/bundle/ruby/2.5.0/gems/activejob-5.2.0/lib/active_job/queue_adapters/delayed_job_adapter.rb:42:in `perform'
/app/vendor/bundle/ruby/2.5.0/gems/delayed_job-4.1.5/lib/delayed/backend/base.rb:81:in `block in invoke_job'
/app/vendor/bundle/ruby/2.5.0/gems/delayed_job-4.1.5/lib/delayed/lifecycle.rb:61:in `block in initialize'
/app/vendor/bundle/ruby/2.5.0/gems/delayed_job-4.1.5/lib/delayed/lifecycle.rb:66:in `execute'
/app/vendor/bundle/ruby/2.5.0/gems/delayed_job-4.1.5/lib/delayed/lifecycle.rb:40:in `run_callbacks'
/app/vendor/bundle/ruby/2.5.0/gems/delayed_job-4.1.5/lib/delayed/backend/base.rb:78:in `invoke_job'
/app/vendor/bundle/ruby/2.5.0/gems/delayed_job-4.1.5/lib/delayed/worker.rb:230:in `block (2 levels) in run'
/usr/lib/ruby/2.5.0/timeout.rb:93:in `block in timeout'
/usr/lib/ruby/2.5.0/timeout.rb:103:in `timeout'
/app/vendor/bundle/ruby/2.5.0/gems/delayed_job-4.1.5/lib/delayed/worker.rb:230:in `block in run'
/usr/lib/ruby/2.5.0/benchmark.rb:308:in `realtime'
/app/vendor/bundle/ruby/2.5.0/gems/delayed_job-4.1.5/lib/delayed/worker.rb:229:in `run'
/app/vendor/bundle/ruby/2.5.0/gems/delayed_job-4.1.5/lib/delayed/worker.rb:312:in `block in reserve_and_run_one_job'
/app/vendor/bundle/ruby/2.5.0/gems/delayed_job-4.1.5/lib/delayed/lifecycle.rb:61:in `block in initialize'
/app/vendor/bundle/ruby/2.5.0/gems/delayed_job-4.1.5/lib/delayed/lifecycle.rb:66:in `execute'
/app/vendor/bundle/ruby/2.5.0/gems/delayed_job-4.1.5/lib/delayed/lifecycle.rb:40:in `run_callbacks'
/app/vendor/bundle/ruby/2.5.0/gems/delayed_job-4.1.5/lib/delayed/worker.rb:312:in `reserve_and_run_one_job'
/app/vendor/bundle/ruby/2.5.0/gems/delayed_job-4.1.5/lib/delayed/worker.rb:213:in `block in work_off'
/app/vendor/bundle/ruby/2.5.0/gems/delayed_job-4.1.5/lib/delayed/worker.rb:212:in `times'
/app/vendor/bundle/ruby/2.5.0/gems/delayed_job-4.1.5/lib/delayed/worker.rb:212:in `work_off'
/app/vendor/bundle/ruby/2.5.0/gems/delayed_job-4.1.5/lib/delayed/worker.rb:175:in `block (4 levels) in start'
/usr/lib/ruby/2.5.0/benchmark.rb:308:in `realtime'
/app/vendor/bundle/ruby/2.5.0/gems/delayed_job-4.1.5/lib/delayed/worker.rb:174:in `block (3 levels) in start'
/app/vendor/bundle/ruby/2.5.0/gems/delayed_job-4.1.5/lib/delayed/lifecycle.rb:61:in `block in initialize'
/app/vendor/bundle/ruby/2.5.0/gems/delayed_job-4.1.5/lib/delayed/lifecycle.rb:66:in `execute'
/app/vendor/bundle/ruby/2.5.0/gems/delayed_job-4.1.5/lib/delayed/lifecycle.rb:40:in `run_callbacks'
/app/vendor/bundle/ruby/2.5.0/gems/delayed_job-4.1.5/lib/delayed/worker.rb:173:in `block (2 levels) in start'
/app/vendor/bundle/ruby/2.5.0/gems/delayed_job-4.1.5/lib/delayed/worker.rb:172:in `loop'
/app/vendor/bundle/ruby/2.5.0/gems/delayed_job-4.1.5/lib/delayed/worker.rb:172:in `block in start'
/app/vendor/bundle/ruby/2.5.0/gems/delayed_job-4.1.5/lib/delayed/plugins/clear_locks.rb:7:in `block (2 levels) in <class:ClearLocks>'
/app/vendor/bundle/ruby/2.5.0/gems/delayed_job-4.1.5/lib/delayed/lifecycle.rb:79:in `block (2 levels) in add'
/app/vendor/bundle/ruby/2.5.0/gems/delayed_job-4.1.5/lib/delayed/lifecycle.rb:61:in `block in initialize'
/app/vendor/bundle/ruby/2.5.0/gems/delayed_job-4.1.5/lib/delayed/lifecycle.rb:79:in `block in add'
/app/vendor/bundle/ruby/2.5.0/gems/delayed_job-4.1.5/lib/delayed/lifecycle.rb:66:in `execute'
/app/vendor/bundle/ruby/2.5.0/gems/delayed_job-4.1.5/lib/delayed/lifecycle.rb:40:in `run_callbacks'
/app/vendor/bundle/ruby/2.5.0/gems/delayed_job-4.1.5/lib/delayed/worker.rb:171:in `start'
/app/lib/delayed_job_worker.rb:6:in `run'
/app/app/concerns/long_runnable.rb:71:in `block in run!'
@dsander
Copy link
Collaborator

dsander commented Sep 27, 2018

The issue isn't really related to huginn_agent isn't it?

I think the exception is happening because the message in the Agent options is empty. Can you share the Agent configuration and the Event you send to it?

@rdoering
Copy link
Author

I wasn't sure if a go Method has to be implented for a specific type.

In this case we could catch this exception and throw a user friendly one telling what is missing.

@dsander
Copy link
Collaborator

dsander commented Sep 28, 2018

True, we could check if opts[:message] is empty before calling this method here.

@rdoering
Copy link
Author

Sounds good. Unfortunately, Im currently not able to write/test the code :-/.

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

No branches or pull requests

2 participants