wrav / oembed

A simple plugin to extract media information from websites, like youtube videos, twitter statuses or blog articles.
MIT License
37 stars 37 forks source link

`Please check your URL` YouTube bug in production #50

Closed jdsimcoe closed 3 years ago

jdsimcoe commented 4 years ago

Hi there! First, thanks so much for the wonderful oEmbed plugin. I'm seeing a current issue on my Laravel Forge / Digital Ocean production environment. It only happens with valid YouTube URLs:

image

The output is simply Please check your URL. Here is an example YouTube URL that I'm trying:

https://www.youtube.com/watch?v=zVi_9rlepbE

I tested it in my Laravel Valet local environment and I couldn't encounter the same issue. Thanks so much for your help!

jdsimcoe commented 4 years ago

I have a staging server on the same stack as production, and it's working fine. I'm wondering if this is some rate limiting somehow. Any ideas on how I can correct this?

reganlawton commented 4 years ago

I’d recommend doing a composer update to get the latest embed/embed version to be some a few fixes recently but rate limiting is common and is why I added caching feature in the settings, which I would recommend trying. I have attached my discord to my profile recently if you need more direct help debugging also.

Moorst commented 4 years ago

Seeing the same issue on 1.3.4. Done composer update for embed/embed with no luck.

jdsimcoe commented 4 years ago

I added embed/embed version ^3.4.8 to my composer.json file and it solved this for me.

reganlawton commented 4 years ago

@Moorst your issue could be related to rate limiting. Are you using the cache feature? If not try using that to prevent the re-hitting of the Youtube servers. Else you might be able to check your logs and if you like to discuss your logs more privately I'm on Discord and you can find my discord via my profile.

Moorst commented 4 years ago

Might be due to rate limit as they're now showing fine. I did try putting the cache on but got an internal server error, will have to debug this locally.

reganlawton commented 4 years ago

@Moorst Youtube has been rate limiting alot lately but I think I need to look at a feature here to generate a snapshot of the embed object on "save" of an entry and then if it fails during the rendering to use that version. It'll mean that we can still access data if the rate limiting happens and might solve generate issues with the 5xx error due to server outage or server errors.

jdsimcoe commented 4 years ago

@reganlawton how do you enable the cache features? Nevermind, solved it.

adrienne commented 4 years ago

@reganlawton - so I was looking into how the field stores data, and this is what it stores in the database:

{"url":"https://youtu.be/ygkmqSijMGg","oembed":null}

So why not just, at save time, actually populate the oembed key with the embed data? You're already fetching it for the preview. Then you don't have to get it every time, you can just always use the stored data. If someone needs to refresh it, they can resave the entry.

reganlawton commented 4 years ago

@adrienne this is what I discussed in my comment 6 days ago, to create a snapshot on the field on create.

adrienne commented 4 years ago

@reganlawton - yeah, i'm just suggesting that you even already have a sort of hook to hang that on, in the data you're already saving.

laurabennett commented 3 years ago

Having this problem with v1.3.6, I've done a composer update and checked embed/embed dependency.

laurabennett commented 3 years ago

If I try to turn on caching I get Serialization of 'class@anonymous' is not allowed.

Is the rate limit based on how many times the API is hit with the code from this plugin? Does that mean as you get more users this will happen more frequently? I have used Embedded Assets by spicy web for other sites but I really liked the admin video preview that comes with this.