-
Notifications
You must be signed in to change notification settings - Fork 1.9k
FacebookBatchResponse failed #619
Comments
Hey @AidasK! Can you include a bit more code that shows how you are creating the requests before you send them to |
I think the case of timeouted batched request is not handled properly |
@yguedidi Ah! Good call. We'll need to look into this. I should be able to give some more TLC in August. :) |
I haven't included it, because it is quite straight forward. This error has happened to me only once. I have sent thousands of notifications before and only one time this error occurred. $requests = [];
foreach ($ids as $id) {
$requests[] = $facebook->request('post', "/$id/notifications", [
'template' => 'You have a new message',
'href' => '?p=' . urlencode($id),
'ref' => 'abc',
]);
}
if (empty($requests)) {
continue;
}
$a = $facebook->sendBatchRequest($requests)->getResponses(); |
@SammyK I'll try ASAP |
@AidasK can you please confirm that the bug happen when you have more that 50 items in your |
I think I was sending exactly 50 notifications in one batch at a time. But not more, because of FB limitations. |
p.s. I don't use facebook notifications anymore, so I don't know if it was fixed. You can close it for now |
Hum... I'm curious how we could reproduce this. |
I don't think we can reproduce it, it is an error from facebook api, but sdk should handle it |
I agree with @AidasK. The same issue happened today when Facebook API had some technical problems and was down for a while at least here in Finland. Because of unresponsiveness of API, the first argument for constructor of Event though these cases are edge cases, I think SDK should be able to survive from it without fatal error. I'm not that familiar with the architecture of SDK, but @SammyK solution in #636 seems fine or maybe even something like this could work:
|
For me, the best fix is to allow null for the original request, but this is a BC break.. I'll then accept the solution proposed in #636 (with some changes) |
This error has appeared 4 times today: Type error: Argument 1 passed to Facebook\FacebookResponse::__construct() must be an instance of Facebook\FacebookRequest, null given, called in /var/www/versions/1498736334/vendor/facebook/graph-sdk/src/Facebook/FacebookBatchResponse.php on line 108 It seems that facebook has responded with an error page, but sdk can't handle it correctly. facebook/graph-sdk 5.5.0 |
I was sending loads of successful batch requests when this happened:
facebook/php-sdk-v4 5.2.0
php7.0
The text was updated successfully, but these errors were encountered: