[SOLVED] Browser-specific Uncaught Twitter Response: [34] Sorry, that page does not exist

oauth
php
error-codes
api

#1

Hi,
I’m dealing with an extremely strange error here. I just finished part of my app and it worked correctly. Now, re-testing and I’m getting this error every time I perform certain list operations on certain browsers.

Fatal error: Uncaught Twitter Response: [34] Sorry, that page does not exist. (TwitterOAuth\Exception\TwitterException) thrown in /****/Auth/AuthAbstract.php on line 254

I’m using this wrapper https://github.com/ricardoper/TwitterOAuth and I doubt this is the wrapper’s fault as all other operations are carried out successfully using the same wrapper.

The worst part of it is that it seems to work on some browsers. I’ve tried on 3 different PCs and a Blackberry.

It works perfectly on the Blackberry and it works on the PC3 using Chrome.

PC1, PC2 - I’m getting the error using either Firefox or Chrome. PC3 - getting error only on Firefox.

Each device is on a different ISP but I can’t imagine how it could be anything to do with the ISP.

This is probably something to do with how each browser interprets the API call.

Anybody has a clue on how to even begin to test and solve this issue?
Thanks.


#2

This does sound strange. “page does not exist” suggests that the URL that is being called / connected to is not valid or cannot be resolved.

There’s a chance that it is related to this, since if the two devices that are failing for some reason are unable to connect to api.twitter.com then that could be related to DNS settings or caches.

I think it is more likely that there’s something going on with the OAuth redirection with the tokens appended. I’m not a PHP wizard though so I’m not the best person to dig deeper. Are you able to share any of your code that calls into the TwitterOAuth wrapper and seems to be failing?


#3

Andy, thanks for your input.

Actually, since I posted my OP, a few more list operations have died a similar death. Without me even touching any code.

here’s an excerpt of my php code:

<?php
//defining the OAuth objects
require 'TwitterOAuth-2/vendor/autoload.php';
use TwitterOAuth\Auth\SingleUserAuth;
use TwitterOAuth\Serializer\ArraySerializer;
date_default_timezone_set('UTC');

    //have we received something from the form input
    if(($_POST['targetlist']) != 0){
                $targetlist = $_POST['targetlist'];
                echo $targetlist; //getting an output here as expected
                       
                //get the members of the ticked list
                $params = array(
                        'list_id' => $targetlist,
                        'count' => 5000,
                        'include_entities' => 'false'
                );

                $response2 = $auth->get('lists/members', $params);
                //this is where the script dies and shows me the aforementioned error
                $errcheck = $auth->getHeaders();
                $respcode = $errcheck['status'];
                echo "<br>response 2 get lists/members<br>";                                           
                print_r($response2);
                         
                    if ($respcode == " 200 OK"){
                        $countids = count($response2['users']);
                            for($j = 0; $j < $countids; $j++){
                                $nonfTwid[] = $response2['users'][$j]['id_str'];
                            }
                        //do the necessary array operations with $nonfTwid
                    }
    }
?>

#4

Bump!


#5

Solved. I’d like to point out that this error is not related to the TwitterOAuth Wrapper!!!

I have several cron jobs carrying out daily maintenance on the database and because of a fault in one of the bots, it was randomly changing the Twitter List IDs to some useles strings. I didn’t recognise this as an issue because these strings still looked like valid Twitter lists.

And it was not happening with all test accounts and not with all of their lists.

That’s why it seemed to me it was working on one browser and failing on another. In reality, it was working when I hit the list IDs of a test user that wasn’t affected by the database fault.

So the main take-away points from this are:

  1. If your Twitter app is powered by a huge and sophisticated database, make sure your fault catching isn’t limited by echoing the PHP variables only.
  2. If you’re going to develop an app that consists of more than 100,000 lines of code, don’t do it on your own. Get a team…