Missing template email/notification in multi-site configuration


(Ernesto Serrano) #1

Hello, I have a multi-site configuration of discourse and I’m getting many retry errors in Sidekiq

Job

Queue default
Job Jobs::UserEmail
Arguments {"type"=>"user_posted", "user_id"=>1, "notification_id"=>3549, "notification_data_hash"=>{"topic_title"=>"***********", "original_post_id"=>497, "original_post_type"=>1, "original_username"=>"*******", "display_username"=>"3 replies"}, "notification_type"=>"posted", "post_id"=>497, "current_site_id"=>"forums37"}
JID ee464a9049a9389bf2cc09d0
Created At 29 minutes ago
Enqueued 10 seconds ago
Retry Count 5
Last Retry just now
Next Retry in 11 minutes

Error

Error Class Jobs::HandledExceptionWrapper
Error Message Wrapped ActionView::MissingTemplate: Missing template email/notification with {:locale=>[:en], :formats=>[:html, :text, :js, :css, :ics, :csv, :vcf, :png, :jpeg, :gif, :bmp, :tiff, :svg, :mpeg, :xml, :rss, :atom, :yaml, :multipart_form, :url_encoded_form, :json, :pdf, :zip, :gzip], :variants=>[], :handlers=>[:raw, :erb, :html, :builder, :ruby]}. Searched in: * “/var/www/discourse/public/app/views”

But if I enter the docker container I can find the notification.html.erb template:

root@app:/var/www/discourse/app/views/email# ls
invite.html.erb		     _secure_mailing_list_post.html.erb
_mailing_list_post.html.erb  template.html.erb
*notification.html.erb*	     unsubscribed.html.erb
_post.html.erb		     unsubscribe.html.erb
resubscribe.html.erb

Any idea of whats happening?


(Matt Palmer) #2

Compare the path in:

Searched in: * “/var/www/discourse/public/app/views”

with

root@app:/var/www/discourse/app/views/email# ls

You’ve misconfigured something somewhere.


(Ernesto Serrano) #3

True! Is weird because I’m using the docker deploy version fixed to v1.9.1

But thank for your help, I quick dirty fix it with
ln -s /var/www/discourse/app /var/www/discourse/public/app

Best regards!


#4

I have the same since I upgraded an existing install to v2.0.0.beta3 +4

Jobs::HandledExceptionWrapper: Wrapped ActionView::MissingTemplate: Missing template email/notification with {:locale=>[:en], :formats=>[:html, :text, :js, :css, :ics, :csv, :vcf, :png, :jpeg, :gif, :b...

I will upgrade when the Travis CI build is fixed.


(Brahn) #5

I am seeing this too, since upgrading from stable v1.9.2 to v1.9.5+5

The only commit in that range that looks related is:

I mean somethings is causing it to look in “public” right, how far off is my wild guess? :slight_smile:


(Sam Saffron) #6

@techAPJ can you repro this on stable ?


(Arpit Jalan) #7

Rendering email/notification.html.erb works fine for me on stable branch on my local dev env.


(Brahn) #8

Could it be specific to multisite? I am running single container multisite here and seeing lots of errors like this:

Message (43 copies reported)
Job exception: Missing template email/notification with {:locale=>[:en], :formats=>[:html, :text, :js, :css, :ics, :csv, :vcf, :png, :jpeg, :gif, :bmp, :tiff, :svg, :mpeg, :xml, :rss, :atom, :yaml, :multipart_form, :url_encoded_form, :json, :pdf, :zip, :gzip], :variants=>[], :handlers=>[:raw, :erb, :html, :builder, :ruby]}. Searched in:
  * "/var/www/discourse/public/app/views

/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/actionview-5.1.4/lib/action_view/path_set.rb:46:in `find'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/actionview-5.1.4/lib/action_view/lookup_context.rb:116:in `find'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/actionview-5.1.4/lib/action_view/renderer/abstract_renderer.rb:18:in `find_template'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/actionview-5.1.4/lib/action_view/renderer/template_renderer.rb:38:in `determine_template'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/actionview-5.1.4/lib/action_view/renderer/template_renderer.rb:8:in `render'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/actionview-5.1.4/lib/action_view/renderer/renderer.rb:42:in `render_template'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/actionview-5.1.4/lib/action_view/renderer/renderer.rb:23:in `render'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/actionview-5.1.4/lib/action_view/helpers/rendering_helper.rb:32:in `render'
/var/www/discourse/app/mailers/user_notifications.rb:481:in `send_notification_email'
/var/www/discourse/app/mailers/user_notifications.rb:371:in `notification_email'
/var/www/discourse/app/mailers/user_notifications.rb:240:in `user_posted'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/actionpack-5.1.4/lib/abstract_controller/base.rb:186:in `process_action'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/actionpack-5.1.4/lib/abstract_controller/callbacks.rb:20:in `block in process_action'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/callbacks.rb:97:in `run_callbacks'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/actionpack-5.1.4/lib/abstract_controller/callbacks.rb:19:in `process_action'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/actionpack-5.1.4/lib/abstract_controller/base.rb:124:in `process'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/actionmailer-5.1.4/lib/action_mailer/rescuable.rb:23:in `block in process'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/actionmailer-5.1.4/lib/action_mailer/rescuable.rb:15:in `handle_exceptions'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/actionmailer-5.1.4/lib/action_mailer/rescuable.rb:22:in `process'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/actionview-5.1.4/lib/action_view/rendering.rb:30:in `process'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/actionmailer-5.1.4/lib/action_mailer/base.rb:609:in `block in process'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/notifications.rb:166:in `block in instrument'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/notifications/instrumenter.rb:21:in `instrument'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/notifications.rb:166:in `instrument'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/actionmailer-5.1.4/lib/action_mailer/base.rb:608:in `process'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/actionmailer-5.1.4/lib/action_mailer/message_delivery.rb:105:in `block in processed_mailer'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/actionmailer-5.1.4/lib/action_mailer/message_delivery.rb:104:in `tap'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/actionmailer-5.1.4/lib/action_mailer/message_delivery.rb:104:in `processed_mailer'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/actionmailer-5.1.4/lib/action_mailer/message_delivery.rb:27:in `__getobj__'
/usr/local/lib/ruby/2.4.0/delegate.rb:80:in `method_missing'
/var/www/discourse/lib/email/sender.rb:30:in `send'
/var/www/discourse/app/jobs/regular/user_email.rb:41:in `execute'
/var/www/discourse/app/jobs/base.rb:134:in `block (2 levels) in perform'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/rails_multisite-1.1.2/lib/rails_multisite/connection_management.rb:77:in `with_connection'
/var/www/discourse/app/jobs/base.rb:129:in `block in perform'
/var/www/discourse/app/jobs/base.rb:125:in `each'
/var/www/discourse/app/jobs/base.rb:125:in `perform'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/sidekiq-5.0.5/lib/sidekiq/processor.rb:188:in `execute_job'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/sidekiq-5.0.5/lib/sidekiq/processor.rb:170:in `block (2 levels) in process'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/sidekiq-5.0.5/lib/sidekiq/middleware/chain.rb:128:in `block in invoke'
/var/www/discourse/lib/sidekiq/pausable.rb:80:in `call'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/sidekiq-5.0.5/lib/sidekiq/middleware/chain.rb:130:in `block in invoke'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/sidekiq-5.0.5/lib/sidekiq/middleware/chain.rb:133:in `invoke'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/sidekiq-5.0.5/lib/sidekiq/processor.rb:169:in `block in process'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/sidekiq-5.0.5/lib/sidekiq/processor.rb:141:in `block (6 levels) in dispatch'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/sidekiq-5.0.5/lib/sidekiq/job_retry.rb:97:in `local'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/sidekiq-5.0.5/lib/sidekiq/processor.rb:140:in `block (5 levels) in dispatch'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/sidekiq-5.0.5/lib/sidekiq.rb:36:in `block in <module:Sidekiq>'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/sidekiq-5.0.5/lib/sidekiq/processor.rb:136:in `block (4 levels) in dispatch'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/sidekiq-5.0.5/lib/sidekiq/processor.rb:204:in `stats'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/sidekiq-5.0.5/lib/sidekiq/processor.rb:131:in `block (3 levels) in dispatch'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/sidekiq-5.0.5/lib/sidekiq/job_logger.rb:7:in `call'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/sidekiq-5.0.5/lib/sidekiq/processor.rb:130:in `block (2 levels) in dispatch'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/sidekiq-5.0.5/lib/sidekiq/job_retry.rb:72:in `global'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/sidekiq-5.0.5/lib/sidekiq/processor.rb:129:in `block in dispatch'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/sidekiq-5.0.5/lib/sidekiq/logging.rb:44:in `with_context'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/sidekiq-5.0.5/lib/sidekiq/logging.rb:38:in `with_job_hash_context'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/sidekiq-5.0.5/lib/sidekiq/processor.rb:128:in `dispatch'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/sidekiq-5.0.5/lib/sidekiq/processor.rb:168:in `process'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/sidekiq-5.0.5/lib/sidekiq/processor.rb:85:in `process_one'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/sidekiq-5.0.5/lib/sidekiq/processor.rb:73:in `run'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/sidekiq-5.0.5/lib/sidekiq/util.rb:16:in `watchdog'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/sidekiq-5.0.5/lib/sidekiq/util.rb:25:in `block in safe_thread'

(Brahn) #9

I noticed that visiting the user_posted email template and hitting save caused this message in the admin logs

New: %{header_instructions} %{message} %{context} %{respond_instructions} 
Previous: translation missing: en.user_notifications.user_mentioned.text_body_template

and after that the notifications started working again.

I also noticed a new error log for

/var/www/discourse/app/mailers/user_notifications.rb:252:in `user_private_message'

but could not see that listed in the email templates. Did a rebuild of the app and now private messages are working too. So far no other errors.


(Ernesto Serrano) #10

In my multisite configuration I had the same problem, to fix it I add this line in my run: section of the app.yml

  # Fix for "missing template" error
  - exec: ln -s /var/www/discourse/app /var/www/discourse/public/app 

(Brahn) #11

Do you still need that after doing a rebuild though?


(Ernesto Serrano) #12

I haven’t tested the last releases but with 1.9.1 and 1.9.2 yes, I need it. This is why I put the fix in the app.yml