Discourse embed: inconsistent errors

We’re trying to implement Discourse embed comments to our documentation website, and we’re facing an inconsistent error with the message “Start discussion” and “Error embedding”.

It’s not a consistent error, we couldn’t identify a pattern. There are pages rendering the comments normally, other pages, the error is present. In some browsers we see it working, others, don’t. Even in the same browser, it works for one of us and doesn’t work for others.

We’re tracking the error on this issue: https://gitlab.com/gitlab-com/gitlab-docs/issues/132, and so far didn’t find anything on our end. Could someone please check this for us? Thanks in advance!

2 Likes

We’re currently on Discourse 1.9.0.beta13 - rolling back to 1.8 or upgrading to 1.19.0.beta14 (Releases · discourse/discourse · GitHub) could be a possible fix?

It’s look like your Allowed Hosts or Path Whitelist not matching the referrer URL in Discourse (in your case docs.gitlab.com and /some/path optional). Can you please double check the setting?

Are you running Discourse with our standard docker installation method?

4 Likes

This is what we have:

and yes, we are running Discourse the official way via Docker.

Maybe we should add a path whitelist?

I think so. You should add “Path Whitelist” as .*

3 Likes

The change should be instant, right? I tried with many variations, but all fail.

.*
.*\.html\z

The interesting thing is that it fails for specific pages for specific browsers. I also checked if there’s an X-Frame-Options header that would deny the iframe, but there isn’t:

curl -I https://docs.gitlab.com
              
HTTP/2 200 
accept-ranges: bytes
cache-control: max-age=600
content-type: text/html; charset=utf-8
expires: Mon, 06 Nov 2017 06:53:14 UTC
last-modified: Mon, 06 Nov 2017 04:23:19 GMT
vary: Origin
content-length: 13259
date: Mon, 06 Nov 2017 06:43:14 GMT

Ok, new info. I just remembered that I had previously created a test category and all topics had already been populated. I now see that some pages point to the old topics. Maybe they conflict, so we’d need to purge all old topics and the old category itself. Using .* seems to work now.

5 Likes

That is the problem. Every time after a URL embedded then it will be stored in DB with referenced topic_id. Let me know if you are unable to purge it.

@vinothkannans seems that works now, but we’ve noticed that in some cases the iframe is stuck at “Loading discussion…”. A page reload fixes it, though. I cannot find anything related in /logs.

I deleted all old topics and then the category itself, so there shouldn’t be any problems. Could this be a cache thing?

We tested internally, and could not reproduce the “Loading discussion…” error! Consider this topic solved! Thanks all!

4 Likes

That’s good news :+1:

4 Likes

Awesome, thanks everyone! :heart:

3 Likes