4.x +
When using Embedded content on a web page (e.g. Homepage with embedded Youtube), if the connection to the 3rd party breaks, this throws an uncaught InvalidUrlException error which renders a 500 error page for a website.
Embed Youtube video on web page using Embeddable object.
Break connection to embedded site (e.g. Connection refused / simulate 503 from 3rd party)
Page that contains embedded content will throw 500 with connection error.
E.g.
error-log.ERROR: Uncaught Exception Embed\Exceptions\InvalidUrlException: "Received HTTP code 503 from proxy after CONNECT" at /sites/website/vendor/embed/embed/src/Embed.php line 144 {"exception":"[object] (Embed\\Exceptions\\InvalidUrlException(code: 0): Received HTTP code 503 from proxy after CONNECT at /sites/website/vendor/embed/embed/src/Embed.php:144)"} []
[ ] The embedded content should log an error, and ...
[ ] allow the rest of the page to render.
A workaround has been provided in the comments, review this for relevancy: https://github.com/silverstripe/silverstripe-framework/issues/9073#issuecomment-576500499
[ ] We'll want to implement both a cache of the content and then ...
[ ] (if needed) allow the content alone to fail gracefully.
[ ] We expect that a default cache of ~1 minute should be enabled in framework. That should sufficient for CWP use-cases as well.
I think we're caching the OEmbed requests, but not forever. So any embed has the potential to break this page, coupling external service availability with your own site - that's not a great design. It should log an error, but render the rest of the page.
+1 on this. Any update when this might be fixed?
@asecondwill Patches welcome :)
Noting that we've had this issue raised again: https://github.com/silverstripe/silverstripe-framework/issues/9294
Not sure if this is the same issue, but I now get a 403 error when trying to embed a vimeo video on SS. Same error regardless of settings - domain restricted, not domain restricted.
Same video works fine in WordPress with either restricted domains or not.
Also experienced this a couple of times hitting third party rate limits, since the Oembed call is done from the server it all comes from the same IP and Youtube/Vimeo can rate limit that IP if the site is fairly heavy on embedded videos.
Hey @asecondwill it might be worth raising a new issue with a bit more detail of your setup. With the limited info, it sounds like it could be a different problem?
I am also experiencing similar.
Currently hosted on SSP and frequently hitting 500 error. So what @scott1702 is saying would make sense if all requests from all our vstacks will be coming from the same IP.
I am embedding youtube video using the "insert media" supplied within tinymce.
When trying to reproduce this locally, interestingly I am getting 12sec + page load times for pages that included a youtube video embedded.
Any workaround would be welcomed!
Hey @josephlewisnz I've put together a little workaround here.
It adds heavier caching to embed shortcodes to reduce the amount of API requests made to third party services (Vimeo, Youtube etc). On top of this, it will catch any errors thrown by the embedded content so in the case of rate limiting it would simply not show the embedded content on the page rather than take the entire page down.
@scott1702 thanks for the fast response and awesome little workaround! Will try this out :)
we have a pull request open that Ivan has been working on for one of our clients at:
https://github.com/silverstripe/silverstripe-framework/pull/9424
that hopefully addresses this?
^ pull request above fails gracefully on unsuccessful media load so that the page will still load.
It does not cache a successful result like scott1702's gist, so we may wish to still implement that
https://github.com/silverstripe/silverstripe-framework/pull/9424 has been merged
Most helpful comment
Hey @josephlewisnz I've put together a little workaround here.
It adds heavier caching to embed shortcodes to reduce the amount of API requests made to third party services (Vimeo, Youtube etc). On top of this, it will catch any errors thrown by the embedded content so in the case of rate limiting it would simply not show the embedded content on the page rather than take the entire page down.