I updated the Twitter module from 7.x-3.1 to 3.2.
The Twitter module 3.1 worked perfect for months.
After the update there are issues in the log, after a cronjob :
"Unexpected error: Sorry, that page does not exist. See attached log image."
I use the Elisia Cron module for scheduling cron jobs. All other cron jobs are working, after the update only the twitter job gives this error.
| Comment | File | Size | Author |
|---|---|---|---|
| #28 | twitter_version_api_d6.patch | 2.1 KB | edhel |
| #22 | twitter_api-version-management-1809720.patch | 3.88 KB | jon.snow |
| #7 | apicreateurl-1809720.patch | 669 bytes | justindodge |
| #4 | twitter-api-1809720.patch | 441 bytes | josevitalsouto |
| Twitter_log.png | 21.65 KB | Anonymous (not verified) |
Comments
Comment #1
Anonymous (not verified) commentedHi,
I had the same issue today and the only way I fixed it was to uninstall the Twitter module. My colleague had the same issue and was unable to access his site, luckily I could still access the site.
I then had to re-register keys and reinstall.
Hope this helps.
Bruce
Comment #2
devilworks commentedUpdating twitter api in twitter setting to api.twitter.com/1 will solve the problem.
Comment #3
brunofm commentedThanks for the tip. I can attest that changing the API URL solved this issue for me.
Comment #4
josevitalsoutoA simple patch, change Twitter API address to "https://api.twitter.com/1".
Comment #5
Matt Fleming commentedChanging the api didn't work for me.
Comment #6
marcus178 commentedDoesn't work for me either
Comment #7
justindodge commentedI think URL is what needs to change, but not for all requests - api.twitter.com/oauth/whatever for example should not have the preceding /1.
Here's a patch I wrote that works for me, but I'm doing very little with the twitter API so I'm sure it could use some testing.
Comment #8
justindodge commentedTo clarify my statement in #7 - the URL should NOT be changed in the module settings, this is a code only fix.
Comment #9
marcus178 commentedThis works for me.
Comment #10
Anonymous (not verified) commentedPatch #7: error in log is gone. Twitter cron gives ok in Elisia Cron.
It is on a life site: I have to wait for fetching new twitter content.
Comment #11
josevitalsoutoDoes this "1" refers to API version?
Comment #12
justindodge commented@vitalsouto - Yes, '1' is the API version.
This info is posted on the 6.x version of this issue, it comes from twitter:
Comment #13
Matt Fleming commentedOn #7, it looks like the TwitterOauth object is only used for OAuth requests.. I'm not sure how your patch would solve the problem, since OAuth shouldn't have the version in the url. The create_url function in the non-OAuth section seems to already add the version to the uri already. Not sure where the breakdown is but I'm having trouble with the registration portion of module. So login and authentication works perfectly and the user lands on the registration page successfully. After logging in or creating an account I get the error.
Comment #14
justindodge commented@Matt - I think the assertion that the TwitterOauth object is only used for OAuth requests is incorrect -
In twitter.pages.inc you have:
This submit function is part of the process of adding an account, and this instance of the TwitterOAuth class calls ->users_show which actually uses the create_url function modified in my patch, since at that point we have the OAuth object. For me this was the holdup - unless I made TwitterOAuth's version of create_url make the adjustment to the outgoing url for this non-oauth request, I couldn't complete the process and got the 'not found' error, since users/show was missing the API version before it. I think but am not sure that the oauth version of the class is used whenever it is possible, but I don't really know the module that well.
Can you be a little more specific about what's going on there? I'm not certain what the problem is you're having at this point or what you're doing to reproduce the problem.
Comment #15
jphelan commented#7 fixed the issue for me.
Comment #16
beatnikdude commentedChanging the Twitter API address to "https://api.twitter.com/1" cleared up the errors for me.
Comment #17
justindodge commented@BeatnikDude - That solution seems to work for some uses cases, but I think you will have problems when doing something like adding a new twitter account, for example.
Comment #18
dernetzjaeger commented#7 fixed the problem for me, too.
Thank's a lot :)
Comment #19
zacho commentedWorks for me, too. However...
Programmatically forcing a "/1" onto the end of the API url bodges any hope of compatibility with other microblogging services, doesn't it? Wouldn't the right solution be to have an extra configuration field for "API version", or else to separate the OAuth API address from the versioned API address?
Comment #20
Matt Fleming commentedSorry I was at the great american beer fest this past weekend and didn't put up the use case.
I have the twitter and twitter sign in modules turned on. There are two major use cases with twitter sign-in:
The actual twitter sign in seems to work perfectly fine. After signing in, I'm sent to the user registration page, also good. The last steps are the problem. No matter which way I go (either sign-in or new registration), I get "Request failed: Sorry, that page does not exist."
Comment #21
devilworks commented#7 fixed the problem.
Add new twitter account - PASS
Import users twitter on cron - PASS
Post to twitter.com - PASS
Sign in with twitter - Not Tested
Comment #22
jon.snow commentedHello,
This patch works for me.
It adds a new variable to set the API version we need to use.
Regards,
Comment #23
fenda commentedI can also confirm the patch in #7 worked for me. But it seems like a kind of hack. Shouldn't we be fixing this module to work only with the Twitter API v1.1 and leave behind 1.0?
Comment #24
justindodge commented@#19, #22, and #23:
I think you guys are adopting an appropriate programmer's attitude about compatibility and being forward thinking, but I don't think multiple versions/variables for the API is applicable here.
The twitter.lib.php file is bound to the version 1 API, and changing to '1.1' or any other thing via variable input would likely just break the code right now. Using a new version of the API needs to coincide with a development effort to support that API on the back end, at which point the version should be hard coded to '1.1', as a variable set to '1' would also break things.
Personally, I can't see the value in being able to use more than one version of the API at a time, but if someone has real justification for it, that would be nice to know.
I'm sure that using the most recent version of the twitter API is the way forward eventually, but for now Twitter has stated:
So there isn't anything especially hacky about the explicit use of a version of the API that is supported by Twitter - what's hacky is the unversioned requests that broke it in the first place.
Personally I continue to recommend the patch at #7.
Hopefully that's helpful!
Comment #25
fizk commentedI created a similar patch here:
http://drupal.org/node/1814610#comment-6610254
Sorry, I didn't see this issue :-)
Comment #26
fenda commentedI agree with #24. I think we should just dump API v1 and support v1.1 in the back end.
Comment #27
pedrohcamara commented#7 work, fixed the issue for me to.
Thanks.
Comment #28
edhel commentedTnx #22, I've created patch for drupal 6 on its base.
Comment #29
timmerk commentedHi edhel, what D6 version of the module did you make the patch for? It's failing on hunk 2 when I try to apply it to the latest dev version (2012-Aug-20), and doesn't look like it works on the latest version in git.
Comment #30
fizk commentedMarking duplicate of #1814610: Use proper API URLs, which has been committed to 7.x-3.x-dev and will be backported to 6.x-3.x-dev.
http://drupalcode.org/project/twitter.git/commitdiff/67814a1
Comment #31
Matt Fleming commented@justindodge
I finally sat down and traced the stack through the application. You were correct on the location of the bug; it was the call to https://api.twitter.com/users/show.json.
After patching the file on my dev box everything worked well but on my production instance it wasn't. On both installations I had the twitter.api.php file in the libraries folder (as well as inside the module directory) and had not patched the twitter.api.php file inside the modules directory.
Do I need the twitter.api.php file in the libraries folder?
Comment #32
justindodge commented@Matt The file in question is actually twitter.lib.php, and it should be in the module's folder, there's no reason that I know to have files in the libraries folder for this module.
fizk has managed to get a patch committed that resolves the issue though, so patching is no longer required - I would just download the latest dev version of the module which has already updated.
Comment #33
edhel commented2timmerk: I use 6.x-3.0-beta3.
Comment #34
xurizaemonfix should be in 6.x-3.x-dev also, as of http://drupalcode.org/project/twitter.git/commitdiff/118d859ebb8e786010b...
this duplicate issue is resolved, please test the -dev version and report back so we can get a stable out