downey reported that while embedding Discourse comments on their Sphinx/Read The Docs site works for most pages, a few randomly fail to load — showing only “Loading Discussion…” and not creating associated topics. The issue appears only in the iframe’s JS console, with an error: Failed to execute 'postMessage' due to origin mismatch between forum.example.org and docs.example.orgdowney. codinghorror suggested checking for URL redirections or network issues, but downey confirmed no redirects and inconsistent behavior — even changing the discourseEmbedUrl value on the same page can make it work or fail. eviltrout advised checking Rails logs and Sidekiq connectivity, noting the server must be able to reach the target page. downey confirmed new topics are still created for most URLs and suspected backend issues. After waiting for hosting support, downey later reported the issue mysteriously resolved itself — problematic pages now create topics as expected, with no clear cause identified. eviltrout offered to check Discourse server logs if needed, but the issue had already self-resolved.
I have set up an embedding using the JS snippet, linking a project documentation site (driven by Sphinx & Read The Docs) to our forum to allow people to comment there on each document.
Overall, the embedding is working – many pages on the site are working fine. But a few (apparently) random pages don’t work at all. The IFRAME appears, as does the site’s logo, but it hangs saying "Loading Discussion..."
The associated topic for these pages with the error is not being created, too. It’s unclear why some pages would fully work and some wouldn’t. The pages that work, do work fine, create the topic excerpt correctly in Discourse, show existing comments from the associated topic, etc.
Yes, but only within the IFRAME itself, and only on the pages that don’t render the content fully. (In other words, this does not appear when the comments render successfully on the same site.)
Failed to execute 'postMessage' on 'DOMWindow': The target origin provided ('http://forum.example.org') does not match the recipient window's origin ('http://docs.example.org').
postUp @ comments?embed_url=http%3A%2F%2Fdocs.example.org%2Fen%2Flatest%2Fprivacy-policy.html:17
window.onload @ comments?embed_url=http%3A%2F%2Fdocs.example.org%2Fen%2Flatest%2Fprivacy-policy.html:38
Nope, no HTTP redirection involved, unfortunately.
Regardless of whether we set the value of discourseEmbedUrl to either the dymanic URL using window.location.href, or just hard code the actual URL, we get the same error as above.
If we hard code the value of discourseEmbedUrl to an existing .html page on the same site that already has an associated topic, things load fine.
If we hard code the value of discourseEmbedUrl to a non-existing .html page on the same site that does not have any associated topic already, we also get the same error.
We are hoping to get a look at our rails log to see if we can see what might be happening (or not) on the back end. Will update here when we learn more.
Are no new topics ever being created anymore, or are they still only being created for random URLs? Is there any rhyme or reason to the URLs that don’t work?
You’ll definitely want to take a look at the Rails logs. It’s possible sidekiq is having problems reaching the destination for some reason. It is necessary that your server can reach the page.
New topics are being created – not just for random URL’s but most any URL except a few problematic ones.
Nothing that we’ve found yet. In fact, we can, on the same page, change the URL that we’re passing the embed.js script, and it works. So it doesn’t seem to be anything on the page itself that’s causing the problem.
Yeah, we think this is the logical next steps. Waiting to hear back from the hosting folks on coordinating this troubleshooting.
Page access seems unlikely since they’re simply different *.html pages on the same site that we’re working with, but it’s possible, I suppose.
Apologies but I didn’t realize you meant on our hosting
We can actually check our error logs for this - can you tell us the last time you saw the problem happen? Otherwise it’s going to be tricky to discover. The exact URL of the embed would be useful too.
Hey there. So I was looking again at this site – hadn’t done so yet this week – and noticed that the pages in question started creating topics as of 2 days ago. Not sure how or why this happened, but suffice to say cannot repro this issue anymore!