Comments not embedding, 500 Error

We have our site set up with discourse, and our main site set up with what looks to be proper comment embeds, passing the current URL and forum host in the embed code.

Yet we’re getting Internal Server Error on the loaded iFrame each time.

Our embed settings are mostly empty - the username is filled in and valid, and the maximum topics is set to 100. Truncate has been tested both on and off, neither works.

If it’s relevant, our logins are via SSO but an existing account was filled in for the username.

Check the Discourse /logs path in your browser when logged in as admin.

RegexpError (target of repeat operator is not specified: /*/) /var/www/discourse/app/models/embeddable_host.rb:33:in `initialize'

Is what we’re getting each time we try to load a page with embedded comments.

Is your site login required to view anything?

No. Only a few pages require it, and the ones it should be pulling from don’t require logins.

1 Like

Can you share your exact embedding settings? Feel free to anonymize the urls if needed.

  DiscourseEmbed = { discourseUrl: 'http://forum.[REDACTED].com/',
                 discourseEmbedUrl: window.location.href };

EDIT: Looks like the image cut off, the last setting just has “emoji”.

Am I allowed to bump? Still having this issue and we were planning on having the comments feature be a big part of our platform in production :S

Nobody is available to look at this at the moment. If you’d like expedited support, please purchase a hosting plan from https://discourse.org/buy

I’m hitting the same issue while testing the embed on my dev environment running v1.9.0.beta11 +46. The browser console shows

GET 
https://stagingdisc.DOMAIN.com/embed/comments [HTTP/2.0 500 Internal Server Error 158ms] 

and on Discourse error logs:

Info:

RegexpError (target of repeat operator is not specified: /*/)
/var/www/discourse/app/models/embeddable_host.rb:28:in `initialize'

Backtrace:

/var/www/discourse/app/models/embeddable_host.rb:28:in `initialize'
/var/www/discourse/app/models/embeddable_host.rb:28:in `new'
/var/www/discourse/app/models/embeddable_host.rb:28:in `block in record_for_url'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.9/lib/active_record/relation/delegation.rb:46:in `each'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.9/lib/active_record/relation/delegation.rb:46:in `each'
/var/www/discourse/app/models/embeddable_host.rb:27:in `record_for_url'
/var/www/discourse/app/models/embeddable_host.rb:39:in `url_allowed?'
/var/www/discourse/app/controllers/embed_controller.rb:109:in `ensure_embeddable'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.9/lib/active_support/callbacks.rb:432:in `block in make_lambda'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.9/lib/active_support/callbacks.rb:145:in `block in halting_and_conditional'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.9/lib/active_support/callbacks.rb:504:in `block in call'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.9/lib/active_support/callbacks.rb:504:in `each'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.9/lib/active_support/callbacks.rb:504:in `call'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.9/lib/active_support/callbacks.rb:92:in `__run_callbacks__'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.9/lib/active_support/callbacks.rb:778:in `_run_process_action_callbacks'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.9/lib/active_support/callbacks.rb:81:in `run_callbacks'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.9/lib/abstract_controller/callbacks.rb:19:in `process_action'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.9/lib/action_controller/metal/rescue.rb:29:in `process_action'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.9/lib/action_controller/metal/instrumentation.rb:32:in `block in process_action'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.9/lib/active_support/notifications.rb:164:in `block in instrument'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.9/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.9/lib/active_support/notifications.rb:164:in `instrument'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.9/lib/action_controller/metal/instrumentation.rb:30:in `process_action'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.9/lib/action_controller/metal/params_wrapper.rb:250:in `process_action'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.9/lib/active_record/railties/controller_runtime.rb:18:in `process_action'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.9/lib/abstract_controller/base.rb:137:in `process'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/actionview-4.2.9/lib/action_view/rendering.rb:30:in `process'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/rack-mini-profiler-0.10.5/lib/mini_profiler/profiling_methods.rb:102:in `block in profile_method'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.9/lib/action_controller/metal.rb:196:in `dispatch'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.9/lib/action_controller/metal/rack_delegation.rb:13:in `dispatch'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.9/lib/action_controller/metal.rb:237:in `block in action'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.9/lib/action_dispatch/routing/route_set.rb:74:in `dispatch'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.9/lib/action_dispatch/routing/route_set.rb:43:in `serve'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.9/lib/action_dispatch/journey/router.rb:43:in `block in serve'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.9/lib/action_dispatch/journey/router.rb:30:in `each'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.9/lib/action_dispatch/journey/router.rb:30:in `serve'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.9/lib/action_dispatch/routing/route_set.rb:817:in `call'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/rack-protection-1.5.3/lib/rack/protection/frame_options.rb:31:in `call'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/omniauth-1.6.1/lib/omniauth/strategy.rb:189:in `call!'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/omniauth-1.6.1/lib/omniauth/strategy.rb:167:in `call'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/omniauth-1.6.1/lib/omniauth/strategy.rb:189:in `call!'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/omniauth-1.6.1/lib/omniauth/strategy.rb:167:in `call'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/omniauth-1.6.1/lib/omniauth/strategy.rb:189:in `call!'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/omniauth-1.6.1/lib/omniauth/strategy.rb:167:in `call'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/omniauth-1.6.1/lib/omniauth/strategy.rb:189:in `call!'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/omniauth-1.6.1/lib/omniauth/strategy.rb:167:in `call'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/omniauth-1.6.1/lib/omniauth/strategy.rb:189:in `call!'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/omniauth-1.6.1/lib/omniauth/strategy.rb:167:in `call'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/omniauth-1.6.1/lib/omniauth/strategy.rb:189:in `call!'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/omniauth-1.6.1/lib/omniauth/strategy.rb:167:in `call'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/omniauth-1.6.1/lib/omniauth/builder.rb:63:in `call'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/rack-1.6.8/lib/rack/conditionalget.rb:25:in `call'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/rack-1.6.8/lib/rack/head.rb:13:in `call'
/var/www/discourse/lib/middleware/anonymous_cache.rb:149:in `call'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.9/lib/action_dispatch/middleware/params_parser.rb:27:in `call'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.9/lib/action_dispatch/middleware/flash.rb:260:in `call'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/rack-1.6.8/lib/rack/session/abstract/id.rb:225:in `context'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/rack-1.6.8/lib/rack/session/abstract/id.rb:220:in `call'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.9/lib/action_dispatch/middleware/cookies.rb:560:in `call'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.9/lib/active_record/query_cache.rb:36:in `call'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.9/lib/active_record/connection_adapters/abstract/connection_pool.rb:653:in `call'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.9/lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.9/lib/active_support/callbacks.rb:88:in `__run_callbacks__'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.9/lib/active_support/callbacks.rb:778:in `_run_call_callbacks'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.9/lib/active_support/callbacks.rb:81:in `run_callbacks'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.9/lib/action_dispatch/middleware/callbacks.rb:27:in `call'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.9/lib/action_dispatch/middleware/remote_ip.rb:78:in `call'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.9/lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.9/lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/logster-1.2.7/lib/logster/middleware/reporter.rb:31:in `call'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/railties-4.2.9/lib/rails/rack/logger.rb:38:in `call_app'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/railties-4.2.9/lib/rails/rack/logger.rb:22:in `call'
/var/www/discourse/config/initializers/100-quiet_logger.rb:17:in `call_with_quiet_assets'
/var/www/discourse/config/initializers/100-silence_logger.rb:29:in `call'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.9/lib/action_dispatch/middleware/request_id.rb:21:in `call'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/rack-1.6.8/lib/rack/methodoverride.rb:22:in `call'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/rack-1.6.8/lib/rack/runtime.rb:18:in `call'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/rack-1.6.8/lib/rack/sendfile.rb:113:in `call'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/rack-mini-profiler-0.10.5/lib/mini_profiler/profiler.rb:282:in `call'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/message_bus-2.0.5/lib/message_bus/rack/middleware.rb:63:in `call'
/var/www/discourse/lib/middleware/request_tracker.rb:73:in `call'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/railties-4.2.9/lib/rails/engine.rb:518:in `call'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/railties-4.2.9/lib/rails/application.rb:165:in `call'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/railties-4.2.9/lib/rails/railtie.rb:194:in `public_send'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/railties-4.2.9/lib/rails/railtie.rb:194:in `method_missing'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/rack-1.6.8/lib/rack/urlmap.rb:66:in `block in call'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/rack-1.6.8/lib/rack/urlmap.rb:50:in `each'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/rack-1.6.8/lib/rack/urlmap.rb:50:in `call'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/unicorn-5.3.0/lib/unicorn/http_server.rb:606:in `process_client'
/var/www/discourse/lib/scheduler/defer.rb:85:in `process_client'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/unicorn-5.3.0/lib/unicorn/http_server.rb:702:in `worker_loop'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/unicorn-5.3.0/lib/unicorn/http_server.rb:549:in `spawn_missing_workers'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/unicorn-5.3.0/lib/unicorn/http_server.rb:142:in `start'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/unicorn-5.3.0/bin/unicorn:126:in `<top (required)>'
/var/www/discourse/vendor/bundle/ruby/2.3.0/bin/unicorn:22:in `load'
/var/www/discourse/vendor/bundle/ruby/2.3.0/bin/unicorn:22:in `<main>'

Env (sanitized DOMAIN):

hostname	discourse1-staging-app
process_id	[488, 341, 440, 393, 608, 314hostname	discourse1-staging-app
process_id	[488, 341, 440, 393, 608, 314]
application_version	87b4246c14eccb77a67839c727c336b224fb584b
HTTP_HOST	stagingdisc.DOMAIN.com
REQUEST_URI	[/embed/comments?embed_url=%2Fdreamobjects%2Ftutorials%2Fhow-to-setup-cross-origin-sharing-on-dreamobjects.html%20, /embed/comments?embed_url=%2Findex.html%20, /embed/comments?embed_url=%2Fdreamobjects%2Ftutorials%2Fhow-to-use-dropshare-with-dreamobjects.html%20, /embed/comments?embed_url=https%3A%2F%2Fstagingdisc.DOMAIN.com%2Findex.html%20, /embed/comments?embed_url=https%3A%2F%2Fstagingdisc.DOMAIN.com%2Fdreamobjects%2Fgettingstarted%2Fwhat-are-objects.html%20, /embed/comments?embed_url=http%3A%2F%2Fsphinx-demo.DOMAIN.com%2Fdreamobjects%2Fgettingstarted%2Fwhat-are-objects.html%20]
REQUEST_METHOD	GET
HTTP_USER_AGENT	Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:55.0) Gecko/20100101 Firefox/55.0
HTTP_ACCEPT	text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
HTTP_REFERER	[http://sphinx-demo.DOMAIN.com/dreamobjects/tutorials/how-to-setup-cross-origin-sharing-on-dreamobjects.html, http://sphinx-demo.DOMAIN.com/, http://sphinx-demo.DOMAIN.com/dreamobjects/tutorials/how-to-use-dropshare-with-dreamobjects.html, http://sphinx-demo.DOMAIN.com/dreamobjects/gettingstarted/what-are-objects.html]
HTTP_X_FORWARDED_FOR	184.23.0.196
HTTP_X_REAL_IP	184.23.0.196
username	smaffulli
	
params	
embed_url	[/dreamobjects/tutorials/how-to-setup-cross-origin-sharing-on-dreamobjects.html , /index.html , /dreamobjects/tutorials/how-to-use-dropshare-with-dreamobjects.html , https://stagingdisc.DOMAIN.com/index.html , https://stagingdisc.DOMAIN.com/dreamobjects/gettingstarted/what-are-objects.html , http://sphinx-demo.DOMAIN.com/dreamobjects/gettingstarted/what-are-objects.html ]]
application_version	87b4246c14eccb77a67839c727c336b224fb584b
HTTP_HOST	stagingdisc.DOMAIN.com
REQUEST_URI	[/embed/comments?embed_url=%2Fdreamobjects%2Ftutorials%2Fhow-to-setup-cross-origin-sharing-on-dreamobjects.html%20, /embed/comments?embed_url=%2Findex.html%20, /embed/comments?embed_url=%2Fdreamobjects%2Ftutorials%2Fhow-to-use-dropshare-with-dreamobjects.html%20, /embed/comments?embed_url=https%3A%2F%2Fstagingdisc.DOMAIN.com%2Findex.html%20, /embed/comments?embed_url=https%3A%2F%2Fstagingdisc.DOMAIN.com%2Fdreamobjects%2Fgettingstarted%2Fwhat-are-objects.html%20, /embed/comments?embed_url=http%3A%2F%2Fsphinx-demo.DOMAIN.com%2Fdreamobjects%2Fgettingstarted%2Fwhat-are-objects.html%20]
REQUEST_METHOD	GET
HTTP_USER_AGENT	Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:55.0) Gecko/20100101 Firefox/55.0
HTTP_ACCEPT	text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
HTTP_REFERER	[http://sphinx-demo.DOMAIN.com/dreamobjects/tutorials/how-to-setup-cross-origin-sharing-on-dreamobjects.html, http://sphinx-demo.DOMAIN.com/, http://sphinx-demo.DOMAIN.com/dreamobjects/tutorials/how-to-use-dropshare-with-dreamobjects.html, http://sphinx-demo.DOMAIN.com/dreamobjects/gettingstarted/what-are-objects.html]
HTTP_X_FORWARDED_FOR	184.23.0.196
HTTP_X_REAL_IP	184.23.0.196
username	smaffulli
	
params	
embed_url	[/dreamobjects/tutorials/how-to-setup-cross-origin-sharing-on-dreamobjects.html , /index.html , /dreamobjects/tutorials/how-to-use-dropshare-with-dreamobjects.html , https://stagingdisc.DOMAIN.com/index.html , https://stagingdisc.DOMAIN.com/dreamobjects/gettingstarted/what-are-objects.html , http://sphinx-demo.DOMAIN.com/dreamobjects/gettingstarted/what-are-objects.html ]

Any idea of what to do about this?

RegexpError (target of repeat operator is not specified: /*/)
/var/www/discourse/app/models/embeddable_host.rb:28:in 'initialize'

It looks like this is an error in your regex in your site settings; correct that error in your site settings.

Do you mean the regexp in the Embedded Settings? I have .* (match the whole title) and I get error 500 on Discourse side.

I don’t think that’s a supported value there, try removing it.

removed it, same issue. If it helps at all, in production.log I always see the same RegexpError no matter what I put in the regexp

Started GET "/embed/comments?embed_url=http%3A%2F%2Fsphinx-demo.DOMAIN.com%2Fdreamcompute%2Fgettingstarted%2Fhow-to-create-private-networks-with-dreamcompute-dashboard.html" for 184.23.0.196 at 2017-10-03 23:41:09 +0000
Processing by EmbedController#comments as HTML
  Parameters: {"embed_url"=>"http://sphinx-demo.DOMAIN.com/dreamcompute/gettingstarted/how-to-create-private-networks-with-dreamcompute-dashboard.html"}
Completed 500 Internal Server Error in 20ms (ActiveRecord: 8.5ms)
RegexpError (target of repeat operator is not specified: /*/)
/var/www/discourse/app/models/embeddable_host.rb:28:in `initialize'

What does this screen show?

I bet you have Path Whitelist of * and it should be .*

pr-welcome to add validation on save when adding path whitelist there.

7 Likes

You win the bet, that was it. Thank you @sam

6 Likes