Php-graph-sdk: Facebook network is unreachable

Created on 27 Feb 2016  路  23Comments  路  Source: facebookarchive/php-graph-sdk

I am using facebook login for my website for past 1 and a half year. Till Feb 11 2016 the login was working fine and I started getting the following error from Feb 12th:
Facebook SDK returned an error: Failed to connect to 2a03:2880:2130:cf05:face:b00c:0:1: Network is unreachable

I raised a ticket with my service provider and they said that they don't support IPv6 routing. Then I spoke to Emil on facebook community group and he said that I should try IPv4 addresses. (https://www.facebook.com/groups/fbdevelopers/permalink/1024527960924051)

I added the following parameters in FacebookCurlHttpClient.php file to force IPv4:
CURLOPT_IPRESOLVE => CURL_IPRESOLVE_V4,

But then I started getting the following error:
Facebook SDK returned an error: connect() time out!

Kindly suggest. IPv6 and IPv4 both is not working for me!

bug

Most helpful comment

@rohit1290 yes Sir.
In my case, I am using Symfony2, so, it's using Buzz to execute the Curl requests.
I modified the vendor file (not recommended)
vendor/kriswallsmith/buzz/lib/Buzz/Client/Curl.php

and added the following in the function send()

curl_setopt($this->lastCurl, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
curl_setopt($this->lastCurl, CURLOPT_TIMEOUT, 30);

All 23 comments

Really appreciate if some can help me with this?

Updates the sdk to 5.0 and the problem was solved. I guess there was some issue with the sdk code.

I guess I was wrong. It's still not working.

Closing it. Unsolved. No hope of getting an answer.

Hey @rohit1290! Do you mind leaving this open? I think there's a real bug here to be addressed. I'd like to try and duplicate the issue myself but haven't had time to poke at the SDK lately. :)

Ok. I am re-opening it.

Yay! Thanks! :)

Having the same problem
IPV6: Unreachable
IPV4: Timeout

I curious if this is a limitation of the Graph API for providers that do not implement IPv6. I'm still not sure how I can set up an environment that will allow me to replicate this issue and test. Any ideas?

I've forced CURL to use IPV4 and increased the timeout to 30 seconds, now it's working :+1:

@juandpr.. can you tell me where and what did you change in the source code for this!

@rohit1290 yes Sir.
In my case, I am using Symfony2, so, it's using Buzz to execute the Curl requests.
I modified the vendor file (not recommended)
vendor/kriswallsmith/buzz/lib/Buzz/Client/Curl.php

and added the following in the function send()

curl_setopt($this->lastCurl, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
curl_setopt($this->lastCurl, CURLOPT_TIMEOUT, 30);

@rohit1290 I'm using laravel that use the same class (like symfony) in : vendor/kriswallsmith/buzz/lib/Buzz/Client/Curl.php to execute cUrl requests, I copied/pasted your code but it's not working.
Any ideas?

@atefBB which code?

Excuse me, I mean the code of @juandpr !
Any way, have you solve this issue?!

Is there going to be a pull request for this? Or an abstraction of the curl options so they can be edited without changing vendor files?

@MartinLyne The HTTP Client is already abstracted and you can create a custom cURL client with custom options.

In my case, it's still working with the hardcode fix I've made last year. If you find any cleaner solution please let me know. Thanks!

Thanks everybody! Closing as the solution looks like to be using a custom client.

@juandpr I used your fix, forcing ipv4, but I am now seeing slow page loading times for users connected with facebook. Did you experience that also ?

@hellomedia Hello, no, for me it's working good. I think that you might have a problem with your network and that particular URL. Try doing a ping to that URL to check the latency.

Thanks @juandpr , I finally got it sorted out. The connection was re-initiated at every page load because of an issue with the application.

@hellomedia great, good to know that you found the solution :)

Was this page helpful?
0 / 5 - 0 ratings