Youtube embeds missing

I have a client for whom embedded youtube videos are missing. They appear in composer’s preview, but when the messages are saved, they disappear. They are working fine in try.discourse.org. I tried whitelisting youtu.be and changing the URL to a youtube.com url too. Neither solved the problem.

The site is running v1.6.0.beta11 +141

2 Likes

Have you tried reaching YouTube from your client’s server?

3 Likes

It seems that the problem was that recent Discourse updates have caused my DOI resolver plugin to muck things up. (I disabled a couple other things too, but it was definitely some plugin. . . )

1 Like

Has anyone got a problem when rebaking posts running into 429 Too Many Requests for youtube.com?

[1] pry(main)> posts = Post.where("raw like '%youtube%'").count
=> 5237

:thinking:

3 Likes

I have encountered this too, it is a temporary IP ban (1h, I believe), and all youtube oneboxes fail for the rebaked posts during that time.

Perhaps there should be some mechanism implemented to prevent more than x requests to youtube per hour when rebaking?

4 Likes

Recently after a series of changes and upgrades to my Discourse Installation, only two things are missing. One is not being able to rebuild the data container, and I’m trying to figure it out, but the other is that every onebox works except with YouTube URLs.

From inside the server and container I can CURL to YouTube, how can I make sure that it is due to temporary IP Ban?

Edit: Can confirm that neither Rebuild (App) nor Rebake affect this issue.

Edit 2: By searching I saw that @jomaxro commented here that things like CloudFlare can affect Oneboxes… can a CDN affect just one Onebox? Tried putting it on Development Mode but no changes.

Edit 3: Tried removing all plugins. Nothing changed. (Also, I’m unable to rebake since it seems that processes cut each other).

Edit 4: Tried @Overgrow’s command and yep, indeed I have a problem

[1] pry(main)> posts = Post.where("raw like '%youtube%'").count
=> 72674

I’m having a hard time trying to run the rebake commands because my container is throwing me this:

PG::UnableToSend: no connection to the server

PG::ConnectionBad: PQconsumeInput() SSL SYSCALL error: EOF detected

Do I need to stop something?

3 Likes

One approach might be to simply rebake using a pattern match and set a delay.

Something like:

rake posts:rebake_match["%youtube%",regex,10]

?

My main issue is being unable to run the command :sweat:

1 Like

This might work to slowly rebake: Post.where("raw like '%youtube%'").where("cooked NOT LIKE '%lazyYT%'").update_all(baked_version: nil)

6 Likes

First of all, thanks a million for taking time to help me @riking.

I ran that command and got what I assume is the number of posts missing: 22462. Based on the last part of the command, is safe to assume that it is running in the background?

1 Like

Yeah, there’s a job that runs every 15 minutes that will re-process SiteSetting.rebake_old_posts_count posts.

4 Likes

Just a question, the number won’t go down no matter how much time passed. Is there a way for me to either follow or force that job?

Hmm, possible that I messed it up :thinking: What’s the result of this? Post.where("raw like '%youtube%'").where("cooked LIKE '%lazyYT%'").count

3 Likes

Current status:

Old Command:

[2] pry(main)> Post.where("raw like '%youtube%'").where("cooked NOT LIKE '%lazyYT%'").update_all(baked_version: nil)
=> 23257

New Command:

[1] pry(main)> Post.where("raw like '%youtube%'").where("cooked LIKE '%lazyYT%'").count
=> 49458

Edit: After some time I can confirm that the second one remains static (same value) while the first one keeps increasing.

1 Like

Regex is not required to match a string in a post. A simple string search will match youtube (for example) well enough. In this example, every post with the string youtube in the post will be rebaked, one per every 100 seconds (very slow…)

Around 100 seconds passed:

I will let this run, guessing that in 76,200 seconds, plus or minus, this rake task will be done :slight_smile:

Guess I should have set this example to a 10 second delay :slight_smile:

2 Likes

Thank you very much @neounix

Tried it, but sadly without success.

I’m starting to believe that maybe there is something related to networking?

Sorry @iceman,

Being a kind of nerdy guy, I don’t understand what “without success” means :slight_smile: (not enough tech info)

You mean when you run the rake command, you get a rails error?

If so, please post the full rails error.

Or, does the rails task execute OK? If so, how many posts were rebaked according to the rake task?

Thanks.

For example, my little (very slow 100 sec delay) sample rebake task (running, for this topic) as been running for hours:

Currently 209 of 762 total…

What are your rebake task numbers?

2 Likes

Pardon me on my poor info!

I meant that I ran it on a small sample and then re-ran it but the number didn’t change.

ie: I ran the command and I had 76000 posts, it baked 200, then stopped and ran another and the new number was 76200 (yes, maybe my users added 400 posts with YouTube on it… but…I don’t know).

Now I’m running it again just to see how it goes but it will take some days :stuck_out_tongue: (76500 hits…)

Since no one else has this issue I’m trying to think on my variables and basically:

  • Changed Machine (So it could be YouTube rate limiting?)
  • Restored a Discourse Backup on a new Install (this shouldn’t be related, but at this point I’m betting on everything that moves)
  • Two Container Installation (Thought I had an issue with the Data rebuild but thanks to this info from @Falco now I know that it is “normal”.
  • Put CloudFlare on top of it following the CDN Tutorials that are here.
1 Like

Sorry for having a thick skull :slight_smile: you mean you are running this rake task?

rake posts:rebake_match['youtube',string,10]

It is important to post exactly what you are typing and seeing.

What is the exact rake task, which parameters are you running?

When you run that rake task, what is the first few lines of output when the tasks starts to rebake?

Please post details, screen shots, copy-and-paste from your command line(s), etc.

2 Likes

Sorry @neounix, you are 100% right.

Let me rephrase:

I ran this command:

root@cont-web-only:/var/www/discourse# time rake posts:rebake_match['youtube',string]
        76597 / 76594 (100.0%)-
    76597 posts done!

Then I was like “well, doh, you need to add the timer, otherwise we can’t test the “Rate Limit Theory””, so I tried the one you posted:

root@cont-web-only:/var/www/discourse# time rake posts:rebake_match['youtube',string,100]
            216 / 76594 (0.2%)-

And stopped it just to go check if things were changing. Apparently nothing, so I thought: “ok, let me run this again and see how it goes”:

root@cont-web-only:/var/www/discourse# time rake posts:rebake_match['youtube',string,100]
           116 / 76598 (0.2%)-

That’s running right now. So my argument was that the number of total posts didn’t go down with the other rebake. (I could be, and possibly am, wrong with this logic).

1 Like