Onebox URI on User Email notification error


(fearlessfrog) #1

Discourse version: Lastest, as of v1.7.0.beta6 +1, tests-passed branch

Sidekiq retries (count - 6):

default
Jobs::UserEmail	
{"type"=>"mailing_list", "user_id"=>43, "current_site_id"=>"default"}
Jobs::HandledExceptionWrapper: Wrapped ArgumentError: bad argument (expected URI object or URI string)

Logs (count 7):

/usr/local/lib/ruby/2.3.0/uri/common.rb:716:in `URI'
/var/www/discourse/lib/email/styles.rb:132:in `block in onebox_styles'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/nokogiri-1.6.8.1/lib/nokogiri/xml/node_set.rb:187:in `block in each'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/nokogiri-1.6.8.1/lib/nokogiri/xml/node_set.rb:186:in `upto'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/nokogiri-1.6.8.1/lib/nokogiri/xml/node_set.rb:186:in `each'
/var/www/discourse/lib/email/styles.rb:130:in `onebox_styles'
/var/www/discourse/lib/email/styles.rb:101:in `format_notification'
/var/www/discourse/app/mailers/user_notifications.rb:433:in `block in apply_notification_styles'
/var/www/discourse/app/mailers/user_notifications.rb:431:in `tap'
/var/www/discourse/app/mailers/user_notifications.rb:431:in `apply_notification_styles'
/var/www/discourse/app/mailers/user_notifications.rb:93:in `mailing_list'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.7.1/lib/abstract_controller/base.rb:198:in `process_action'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.7.1/lib/abstract_controller/callbacks.rb:20:in `block in process_action'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:88:in `__run_callbacks__'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:778:in `_run_process_action_callbacks'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:81:in `run_callbacks'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.7.1/lib/abstract_controller/callbacks.rb:19:in `process_action'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.7.1/lib/abstract_controller/base.rb:137:in `process'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/actionview-4.2.7.1/lib/action_view/rendering.rb:30:in `process'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/actionmailer-4.2.7.1/lib/action_mailer/base.rb:596:in `block in process'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/notifications.rb:164:in `block in instrument'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/notifications.rb:164:in `instrument'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/actionmailer-4.2.7.1/lib/action_mailer/base.rb:593:in `process'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/actionmailer-4.2.7.1/lib/action_mailer/base.rb:584:in `initialize'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/actionmailer-4.2.7.1/lib/action_mailer/message_delivery.rb:25:in `new'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/actionmailer-4.2.7.1/lib/action_mailer/message_delivery.rb:25:in `__getobj__'
/usr/local/lib/ruby/2.3.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:154:in `block (2 levels) in perform'

Just started happening today, so thought I’d report it.

Plugins installed:

babble	1.1.0	
discourse-cakeday	0.0.13	
discourse-details	0.4	
dice_roller	2	
discourse-nginx-performance-report	0.1	
Spoiler Alert!	0.3	
docker_manager	0.1		
lazyYT	1.0.1	
poll	0.9		
Steam Store Widget Onebox	0.2

(Régis Hanol) #2

Could you post (or PM me) the raw content of the post that is triggering that error?


(fearlessfrog) #3

We think it is this but not sure how to trace back to the post from the error logs above:

1] pry(main)> p = Post.find(29814)
=> #<Post:0x007f60e513e5a0
 id: 29814,
 user_id: 326,
 topic_id: 2836,
 post_number: 57,
 raw:
  "Stephen - Crossfire\nhttps://www.youtube.com/watch?v=fcsDG_jVYbc\n\nJoey Pecoraro - Ellie\n<iframe style=\"border: 0; width: 100%; height: 120px;\" src=\"https://bandcamp.com/EmbeddedPlayer/album=2727050383/size=large/bgcol=ffffff/linkcol=0687f5/tracklist=false/artwork=small/track=1985738013/transparent=true/\" seamless><a href=\"http://joeypecoraro.bandcamp.com/album/discography\">Discography by Joey Pecoraro</a></iframe>\nhttps://joeypecoraro.bandcamp.com/track/ellie\n\nI'd suggest giving the whole album a listen if you like this track, I've really enjoyed it this week.",
 cooked:
  "<p>Stephen - Crossfire<br></p><div class=\"lazyYT\" data-youtube-id=\"fcsDG_jVYbc\" data-youtube-title=\"Crossfire\" data-width=\"480\" data-height=\"270\" data-parameters=\"feature=oembed&amp;wmode=opaque\"></div>\n\n<p>Joey Pecoraro - Ellie<br><iframe><a href=\"http://joeypecoraro.bandcamp.com/album/discography\">Discography by Joey Pecoraro</a></iframe><br><a href=\"https://joeypecoraro.bandcamp.com/track/ellie\" class=\"onebox\" target=\"_blank\">https://joeypecoraro.bandcamp.com/track/ellie</a></p>\n\n<p>I'd suggest giving the whole album a listen if you like this track, I've really enjoyed it this week.</p>",
 created_at: Thu, 20 Oct 2016 04:01:33 UTC +00:00,
 updated_at: Thu, 20 Oct 2016 04:01:33 UTC +00:00,

Based on a similar Sidekiq retrying error that shows the Post id:

default	
Jobs::UserEmail	
{"type"=>"user_posted", "user_id"=>377, "notification_id"=>56459, "notification_data_hash"=>{"topic_title"=>"What we hearing? - Mudspike plays", "original_post_id"=>29814, "original_post_type"=>1, "original_username"=>"Andrew116", "display_username"=>"Andrew116"}, "notification_type"=>"posted", "post_id"=>29814, "current_site_id"=>"default"}
Jobs::HandledExceptionWrapper: Wrapped ArgumentError: bad argument (expected URI object or URI string)

The post URL on our forum is here:

Some sort of embedded player in Onebox that choked?


(Rafael dos Santos Silva) #4

That bandcamp iframe isn’t working for me, it’s and empty iframe without url.


(fearlessfrog) #5

Yep, I see it as a bad iframe too.

Does the Discourse composer filter out the iframe tag by default? I think if I put the text

<iframe>

then I get the following. It looks like it stops anything from showing afterwards without a proper close tag and then causes mischief for the email notification formatters as well.

Did a /iframe tag above this line.

EDIT: As this looks data related I’ll edit that message on our forums to let Sidekiq carry on and finish. Hope this helped.


(Régis Hanol) #6

Thanks for reporting that issue @fearlessfrog. I just pushed a fix :banana:


(Régis Hanol) #7

This topic was automatically closed after 6 hours. New replies are no longer allowed.