iamcal / oembed

The oEmbed Spec
http://oembed.com
MIT License
1.32k stars 651 forks source link

Getting PHP Error when trying to fetch the providers list #499

Closed amjad1233 closed 3 years ago

amjad1233 commented 3 years ago

Hi There,

When I am trying to curl to the providers URL I am getting following.

`Fatal error: Uncaught Error: Call to undefined function yaml_parse_file() in /var/www/html/oembed.com/www/json.php:14 Stack trace:

0 {main}

thrown in /var/www/html/oembed.com/www/json.php on line 14

GuyRus commented 3 years ago

Hi @amjad1233

We had this issue crop up in a Drupal site using oembed. This is related to the "https://oembed.com/providers.json" file returning a 200 (i.e. so it passes checks), but returning bad file contents via curl:

`$ curl "https://oembed.com/providers.json"
Fatal error: Uncaught Error: Call to undefined function yaml_parse_file() in /var/www/html/oembed.com/www/json.php:14 Stack trace:

0 {main}

thrown in /var/www/html/oembed.com/www/json.php on line 14
`

`$ php -r "var_dump(file_get_contents('https://oembed.com/providers.json'));" string(237) "
Fatal error: Uncaught Error: Call to undefined function yaml_parse_file() in /var/www/html/oembed.com/www/json.php:14 Stack trace:

0 {main}

thrown in /var/www/html/oembed.com/www/json.php on line 14
`

It seems to work fine via a browser or with the Accept-Encoding header.

Potential resolution is to create a local copy of providers.json and serve it from local disk until oembed resolve the issue. We also suspect this could be a regional issue with a Cloudfront edge node having cached a bad copy of the endpoint (We're in AU region) as other regions seem to not have this issue.

Cheers,

amjad1233 commented 3 years ago

Thanks @GuyRus we had the same issue on Drupal. I did create local copy and pointed it there which resolves the issue temporarily. The good thing was it was in config as well.

For any drupallers this may help.

drush cset media.settings oembed_providers_url "https://URL to local file"

Cloudfare could be right because we are using it as well, and we are in AU as well.

iamcal commented 3 years ago

this should now be fixed

2pha commented 3 years ago

I am having this problem too. navigating to the url in the browser seems fine. But here is a curl request. I think I am testing this correctly

root@98084fd12b50:/var/www/html# curl https://oembed.com/providers.json
Fatal error: Uncaught Error: Call to undefined function yaml_parse_file() in /var/www/html/oembed.com/www/json.php:14 Stack trace:

0 {main}

thrown in /var/www/html/oembed.com/www/json.php on line 14

iamcal commented 3 years ago

once all caches empty (should be in the next 10 mins) then it should be functional everywhere

tommyvca commented 3 years ago

once all caches empty (should be in the next 10 mins) then it should be functional everywhere

can do a purge cache in cloudflare? still not working in other countries.

ATech-Developers commented 3 years ago

Still failing in AUS via the SYD4-C2 CloudFront pop:

$ curl -v "https://oembed.com/providers.json"
...
* Connection state changed (MAX_CONCURRENT_STREAMS == 128)!
< HTTP/2 200 
< content-type: text/plain; charset=utf-8
< content-length: 237
< date: Wed, 02 Dec 2020 20:50:59 GMT
< server: Apache
< vary: Accept-Encoding
< x-cache: Hit from cloudfront
< via: 1.1 bb9f263574d02812181ed6540110c7f3.cloudfront.net (CloudFront)
< x-amz-cf-pop: SYD4-C2
< x-amz-cf-id: yOVrMYCYz2wPx9vKUO-E6-2tHeCWgXuUkLV7KcUn7WbnCsAz-_VXBg==
< age: 28040
< 
<br />
<b>Fatal error</b>:  Uncaught Error: Call to undefined function yaml_parse_file() in /var/www/html/oembed.com/www/json.php:14
Stack trace:
#0 {main}
  thrown in <b>/var/www/html/oembed.com/www/json.php</b> on line <b>14</b><br />
* Connection #0 to host oembed.com left intact
mstrelan commented 3 years ago

I tested a few IPs listed on https://www.whatsmydns.net/#A/oembed.com

Also failing from France on 143.204.226.104 (CDG3-C1).

larowlan commented 3 years ago

Cloudfront is showing this with an age of 31000, ie about 8 hrs, so I'm not sure the purge worked

dingsoyr commented 3 years ago

Not working from Norway

agoradesign commented 3 years ago

not working from Austria

RandalVanheede commented 3 years ago

Also not working in Belgium:

$ curl -v https://oembed.com/providers.json
...
* Connection state changed (MAX_CONCURRENT_STREAMS updated)!
< HTTP/2 200 
< content-type: text/plain; charset=utf-8
< content-length: 237
< date: Thu, 03 Dec 2020 01:38:05 GMT
< server: Apache
< vary: Accept-Encoding
< x-cache: Hit from cloudfront
< via: 1.1 425cbe8f956bdcb8754c19eb873fd2d1.cloudfront.net (CloudFront)
< x-amz-cf-pop: AMS50-C1
< x-amz-cf-id: ry_PdDCHIewNn4z_Sn0Gf9DPt8ruWVkVT4ogHcLhsKOU6_4qdaLNdQ==
< age: 25781
larowlan commented 3 years ago

The fact that the age has gone down (25781 in last comment, 31000 before when I checked) would indicate that is not fixed at the source yet

yuseferi commented 3 years ago

not working

MatthieuScarset commented 3 years ago

Still not working from France

fmuellerprevion commented 3 years ago

Also not working for me in Switzerland.

I'm getting the following request headers:

age: 32450
content-encoding: gzip
content-length: 184
content-type: text/plain; charset=utf-8
date: Thu, 03 Dec 2020 01:30:09 GMT
server: Apache
status: 200
vary: Accept-Encoding
via: 1.1 08c5e904e2f0226b2d9c1417f32b12f2.cloudfront.net (CloudFront)
x-amz-cf-id: vVb9tEK3XiHnO2D43rGDZeU51W94qXT8_t8AsOzcXrm8DHnWUj580Q==
x-amz-cf-pop: ZRH50-C1
x-cache: Hit from cloudfront
Berdir commented 3 years ago

I suspect a lot of people here are using Drupal because our error handling is bad. For those, see https://www.drupal.org/project/drupal/issues/3186184#comment-13924958 for a long-term fix and my short-term workaround.

2pha commented 3 years ago

Drupal users can get around the problem by using the oembed_providers module as explained in the this core issue

jbertoen commented 3 years ago

Still giving this issue, created a new issue.