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

Email processor (griddler) not initialized before any helpy action trigged #2058

Open
duc2019 opened this issue Sep 14, 2021 · 2 comments
Open

Comments

@duc2019
Copy link

duc2019 commented Sep 14, 2021

For now griddler initialized in application_controller, which mean if email arrived before any helpy action trigged, griddler will use default config for everything, usually result a 500 response.

App started => access helpy (intialize griddler) => send email to email processor => ok
App started => send email to email processor => error

Here is the fix:
lixiljp@a9ad3af#diff-060d21e42b536250ae3fa8cab5ba0ab2a4d1f3cd88c6472f497887b9616356aa

@scott
Copy link
Member

scott commented Sep 14, 2021

Hey @duc2019 thanks for providing this. Can you elaborate on when and under which conditions you experienced this error? Any idea on how to reproduce under production use?

@duc2019
Copy link
Author

duc2019 commented Sep 15, 2021

We did not use helpy on production environment yet, but here is the reproduction steps:

  • create a sendgrid account
  • create a mailbox for inbound mail and create the mx record (10 mx.sendgrid.net)
  • setup sendgrid Inbound Parse for helpy (email send to the mailbox will forward to https://{helpy_domain}/email_processor)
  • goto helpy and enable Inbound Mail with sendgrid provider
  • stop helpy instance
  • start helpy instance
  • don't access helpy web interface (it will trigger application_controller.set_vars which initializes griddler)
  • send a email to the mailbox
  • griddler throws error because not initialized (the default provider which is mandrill are used to process the request sent from sendgrid)
helpy_1        | F, [2021-09-15T04:13:35.334983 #29] FATAL -- : 
helpy_1        | TypeError (no implicit conversion of nil into String):
helpy_1        |   json (2.3.1) lib/json/common.rb:263:in `initialize'
helpy_1        |   json (2.3.1) lib/json/common.rb:263:in `new'
helpy_1        |   json (2.3.1) lib/json/common.rb:263:in `parse'
helpy_1        |   activesupport (4.2.11.1) lib/active_support/json/decoding.rb:26:in `decode'
helpy_1        |   griddler-mandrill (1.1.4) lib/griddler/mandrill/adapter.rb:38:in `events'
helpy_1        |   griddler-mandrill (1.1.4) lib/griddler/mandrill/adapter.rb:14:in `normalize_params'
helpy_1        |   griddler-mandrill (1.1.4) lib/griddler/mandrill/adapter.rb:10:in `normalize_params'
helpy_1        |   griddler (1.5.2) app/controllers/griddler/emails_controller.rb:19:in `normalized_params'
helpy_1        |   griddler (1.5.2) app/controllers/griddler/emails_controller.rb:5:in `create'
helpy_1        |   actionpack (4.2.11.1) lib/action_controller/metal/implicit_render.rb:4:in `send_action'
helpy_1        |   actionpack (4.2.11.1) lib/abstract_controller/base.rb:198:in `process_action'
helpy_1        |   actionpack (4.2.11.1) lib/action_controller/metal/rendering.rb:10:in `process_action'
helpy_1        |   actionpack (4.2.11.1) lib/abstract_controller/callbacks.rb:20:in `block in process_action'
helpy_1        |   activesupport (4.2.11.1) lib/active_support/callbacks.rb:117:in `call'
helpy_1        |   activesupport (4.2.11.1) lib/active_support/callbacks.rb:555:in `block (2 levels) in compile'
helpy_1        |   activesupport (4.2.11.1) lib/active_support/callbacks.rb:505:in `call'
helpy_1        |   activesupport (4.2.11.1) lib/active_support/callbacks.rb:498:in `block (2 levels) in around'
helpy_1        |   activesupport (4.2.11.1) lib/active_support/callbacks.rb:313:in `block (2 levels) in halting'
helpy_1        |   route_translator (4.4.1) lib/route_translator/extensions/action_controller.rb:27:in `set_locale_from_url'
helpy_1        |   activesupport (4.2.11.1) lib/active_support/callbacks.rb:432:in `block in make_lambda'
helpy_1        |   activesupport (4.2.11.1) lib/active_support/callbacks.rb:312:in `block in halting'
helpy_1        |   activesupport (4.2.11.1) lib/active_support/callbacks.rb:497:in `block in around'
helpy_1        |   activesupport (4.2.11.1) lib/active_support/callbacks.rb:505:in `call'
helpy_1        |   activesupport (4.2.11.1) lib/active_support/callbacks.rb:92:in `__run_callbacks__'
helpy_1        |   activesupport (4.2.11.1) lib/active_support/callbacks.rb:778:in `_run_process_action_callbacks'
helpy_1        |   activesupport (4.2.11.1) lib/active_support/callbacks.rb:81:in `run_callbacks'
helpy_1        |   actionpack (4.2.11.1) lib/abstract_controller/callbacks.rb:19:in `process_action'
helpy_1        |   actionpack (4.2.11.1) lib/action_controller/metal/rescue.rb:29:in `process_action'
helpy_1        |   actionpack (4.2.11.1) lib/action_controller/metal/instrumentation.rb:32:in `block in process_action'
helpy_1        |   activesupport (4.2.11.1) lib/active_support/notifications.rb:164:in `block in instrument'
helpy_1        |   activesupport (4.2.11.1) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
helpy_1        |   activesupport (4.2.11.1) lib/active_support/notifications.rb:164:in `instrument'
helpy_1        |   actionpack (4.2.11.1) lib/action_controller/metal/instrumentation.rb:30:in `process_action'
helpy_1        |   actionpack (4.2.11.1) lib/action_controller/metal/params_wrapper.rb:250:in `process_action'
helpy_1        |   activerecord (4.2.11.1) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
helpy_1        |   actionpack (4.2.11.1) lib/abstract_controller/base.rb:137:in `process'
helpy_1        |   actionview (4.2.11.1) lib/action_view/rendering.rb:30:in `process'
helpy_1        |   actionpack (4.2.11.1) lib/action_controller/metal.rb:196:in `dispatch'
helpy_1        |   actionpack (4.2.11.1) lib/action_controller/metal/rack_delegation.rb:13:in `dispatch'
helpy_1        |   actionpack (4.2.11.1) lib/action_controller/metal.rb:237:in `block in action'
helpy_1        |   actionpack (4.2.11.1) lib/action_dispatch/routing/route_set.rb:74:in `dispatch'
helpy_1        |   actionpack (4.2.11.1) lib/action_dispatch/routing/route_set.rb:43:in `serve'
helpy_1        |   actionpack (4.2.11.1) lib/action_dispatch/journey/router.rb:43:in `block in serve'
helpy_1        |   actionpack (4.2.11.1) lib/action_dispatch/journey/router.rb:30:in `each'
helpy_1        |   actionpack (4.2.11.1) lib/action_dispatch/journey/router.rb:30:in `serve'
helpy_1        |   actionpack (4.2.11.1) lib/action_dispatch/routing/route_set.rb:817:in `call'
helpy_1        |   http_accept_language (2.1.1) lib/http_accept_language/middleware.rb:14:in `call'
helpy_1        |   rack-cors (1.0.6) lib/rack/cors.rb:98:in `call'
helpy_1        |   warden (1.2.7) lib/warden/manager.rb:36:in `block in call'
helpy_1        |   warden (1.2.7) lib/warden/manager.rb:35:in `catch'
helpy_1        |   warden (1.2.7) lib/warden/manager.rb:35:in `call'
helpy_1        |   client_side_validations (4.2.12) lib/client_side_validations/middleware.rb:15:in `call'
helpy_1        |   rack (1.6.13) lib/rack/etag.rb:24:in `call'
helpy_1        |   rack (1.6.13) lib/rack/conditionalget.rb:38:in `call'
helpy_1        |   rack (1.6.13) lib/rack/head.rb:13:in `call'
helpy_1        |   actionpack (4.2.11.1) lib/action_dispatch/middleware/params_parser.rb:27:in `call'
helpy_1        |   actionpack (4.2.11.1) lib/action_dispatch/middleware/flash.rb:260:in `call'
helpy_1        |   rack (1.6.13) lib/rack/session/abstract/id.rb:252:in `context'
helpy_1        |   rack (1.6.13) lib/rack/session/abstract/id.rb:247:in `call'
helpy_1        |   actionpack (4.2.11.1) lib/action_dispatch/middleware/cookies.rb:560:in `call'
helpy_1        |   activerecord (4.2.11.1) lib/active_record/query_cache.rb:36:in `call'
helpy_1        |   activerecord (4.2.11.1) lib/active_record/connection_adapters/abstract/connection_pool.rb:653:in `call'
helpy_1        |   actionpack (4.2.11.1) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
helpy_1        |   activesupport (4.2.11.1) lib/active_support/callbacks.rb:88:in `__run_callbacks__'
helpy_1        |   activesupport (4.2.11.1) lib/active_support/callbacks.rb:778:in `_run_call_callbacks'
helpy_1        |   activesupport (4.2.11.1) lib/active_support/callbacks.rb:81:in `run_callbacks'
helpy_1        |   actionpack (4.2.11.1) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
helpy_1        |   actionpack (4.2.11.1) lib/action_dispatch/middleware/remote_ip.rb:78:in `call'
helpy_1        |   actionpack (4.2.11.1) lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
helpy_1        |   actionpack (4.2.11.1) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
helpy_1        |   railties (4.2.11.1) lib/rails/rack/logger.rb:38:in `call_app'
helpy_1        |   railties (4.2.11.1) lib/rails/rack/logger.rb:22:in `call'
helpy_1        |   request_store (1.5.0) lib/request_store/middleware.rb:19:in `call'
helpy_1        |   actionpack (4.2.11.1) lib/action_dispatch/middleware/request_id.rb:21:in `call'
helpy_1        |   rack (1.6.13) lib/rack/methodoverride.rb:22:in `call'
helpy_1        |   rack (1.6.13) lib/rack/runtime.rb:18:in `call'
helpy_1        |   activesupport (4.2.11.1) lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
helpy_1        |   actionpack (4.2.11.1) lib/action_dispatch/middleware/static.rb:120:in `call'
helpy_1        |   rack (1.6.13) lib/rack/sendfile.rb:113:in `call'
helpy_1        |   railties (4.2.11.1) lib/rails/engine.rb:518:in `call'
helpy_1        |   railties (4.2.11.1) lib/rails/application.rb:165:in `call'
helpy_1        |   unicorn (5.7.0) lib/unicorn/http_server.rb:632:in `process_client'
helpy_1        |   unicorn (5.7.0) lib/unicorn/http_server.rb:728:in `worker_loop'
helpy_1        |   unicorn (5.7.0) lib/unicorn/http_server.rb:548:in `spawn_missing_workers'
helpy_1        |   unicorn (5.7.0) lib/unicorn/http_server.rb:144:in `start'
helpy_1        |   unicorn (5.7.0) bin/unicorn:128:in `<top (required)>'
helpy_1        |   /opt/helpy-bundle/bin/unicorn:23:in `load'
helpy_1        |   /opt/helpy-bundle/bin/unicorn:23:in `<top (required)>'
helpy_1        |   /usr/local/lib/ruby/site_ruby/2.5.0/bundler/cli/exec.rb:74:in `load'
helpy_1        |   /usr/local/lib/ruby/site_ruby/2.5.0/bundler/cli/exec.rb:74:in `kernel_load'
helpy_1        |   /usr/local/lib/ruby/site_ruby/2.5.0/bundler/cli/exec.rb:28:in `run'
helpy_1        |   /usr/local/lib/ruby/site_ruby/2.5.0/bundler/cli.rb:463:in `exec'
helpy_1        |   /usr/local/lib/ruby/site_ruby/2.5.0/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
helpy_1        |   /usr/local/lib/ruby/site_ruby/2.5.0/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
helpy_1        |   /usr/local/lib/ruby/site_ruby/2.5.0/bundler/vendor/thor/lib/thor.rb:387:in `dispatch'
helpy_1        |   /usr/local/lib/ruby/site_ruby/2.5.0/bundler/cli.rb:27:in `dispatch'
helpy_1        |   /usr/local/lib/ruby/site_ruby/2.5.0/bundler/vendor/thor/lib/thor/base.rb:466:in `start'
helpy_1        |   /usr/local/lib/ruby/site_ruby/2.5.0/bundler/cli.rb:18:in `start'
helpy_1        |   /usr/local/bin/bundle:30:in `block in <main>'
helpy_1        |   /usr/local/lib/ruby/site_ruby/2.5.0/bundler/friendly_errors.rb:124:in `with_friendly_errors'
helpy_1        |   /usr/local/bin/bundle:22:in `<main>'

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