I’ve been trying for a while to embed Discourse comments on another site but still haven’t been able to make it work. I started following the instructions on this blog: http://eviltrout.com/2014/01/22/embedding-discourse.html and later on I found other issues, which I was able to fix with guidance from topics on this forum.
I’m now at the stage where I think everything is set up correctly, but for some reason topics don’t get created on the Discourse side (when visiting a page on the client site, the embedded iframe only shows “Loading discussion”). I’ve double-checked (dozens of times actually) the embed settings on Discourse, the embed snippet on the client site (including the canonical URLs), logs, etc and couldn’t find anything wrong, so I started looking into something on our deployment setup.
I just wanted to clarify how the embedding works so I can investigate a bit further. My understanding is that whenever a user visits a page on the blog or site that embeds the comments, a request is made to Discourse, which will pull the referring page contents and create a topic on the fly if it does not exist (my site does not have an RSS feed).
My questions are:
Is my assumption on how the embedding works correct?
How could I debug if indeed Discourse is having trouble creating the topics from the remote site?
Apologies if this is somewhat obvious but I’m not familiar with Discourse or Rails
Can you provide a screenshot to your Discourse embedding settings? What is powering the backend of your blog/site? Is it static html (from a generator) or WordPress or Ghost?
Any pointers or ideas here would be greatly appreciated.
The rails log shows that the request is received correctly:
Started GET "/embed/comments?embed_url=http%3A%2F%2Fddhstaging.satapps.org%2Fdataset%2F473cdee9-565c-4a9b-99a8-e8c836837086" for 165.254.84.238 a
t 2015-06-24 15:14:27 +0000
Processing by EmbedController#comments as HTML
Parameters: {"embed_url"=>"http://ddhstaging.satapps.org/dataset/473cdee9-565c-4a9b-99a8-e8c836837086"}
Rendered embed/loading.html.erb within layouts/embed (0.9ms)
Completed 200 OK in 22ms (Views: 3.1ms | ActiveRecord: 5.9ms)
But nothing happens from there, no topics are created and on the client site the iframe keeps refreshing to the same Loading Discussion page. On the server, the topic_embeds table is empty.
I’ve tracked all the code up until topic_embed.rb where the remote contents should get pulled, but looking at the traffic on the server it doesn’t seem that the contents are being requested, so something is failing before.
Embedding was working before on talk.beta.nyc and data.beta.nyc before this change.
@eviltrout, I noticed that fishtank.eviltrout.com is on Discourse 1.4.0.beta1 which predates this change. Will it still work if its upgraded to the latest beta?
FYI, talk.beta.nyc is running on v1.4.0.beta3 +71.
I can confirm that rebuilding the Discourse site from scratch targeting v1.4.0.beta1 fixes the embedding. So it seems like some sort of regression has happened on the meantime (probably what @jqnatividad mentions).
You can’t do the downgrade easily because database changes occurred between beta1 and beta3.
You’ll have to restore a database backup prior to the upgrade if you can.
Anyway, to install a fixed version of discourse, you can add the following lines in your container.yml file:
Okay sorry guys! There was indeed a bug here. It was serious enough that I’ve updated the latest beta to include it too. So if you are tracking beta just upgrade and you’ll get the patch.