Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
1. Authenticated successfully
2. Created an action to post tweeter message for specific nodes when they are publish
3. Unpublish and then publush node => received "Successfully posted to Twitter" message
4. Nothing on twitter and log contains error message:
exception 'TwitterException' with message 'Unauthorized' in /path/sites/all/modules/contrib/twitter/twitter.lib.php:151 Stack trace: #0 /path/sites/all/modules/contrib/twitter/twitter.lib.php(116): Twitter->request('https://api.twi...', Array, 'POST') #1 /path/sites/all/modules/contrib/twitter/twitter.lib.php(1225): Twitter->auth_request('https://api.twi...', Array, 'POST') #2 /path/sites/all/modules/contrib/twitter/twitter.lib.php(355): Twitter->call('statuses/update', Array, 'POST') #3 /path/sites/all/modules/contrib/twitter/twitter.inc(180): Twitter->statuses_update('
What gets we...') #4 /path/sites/all/modules/contrib/twitter/twitter_actions/twitter_actions.rules.inc(68): twitter_set_status(Object(TwitterUser), '
What gets we...') #5 [internal function]: twitter_actions_set_status('
What gets we...', '[current user]', Array, Object(RulesState), Object(RulesAction), 'execute') #6 /path/sites/all/modules/contrib/rules/includes/faces.inc(123): call_user_func_array('twitter_actions...', Array) #7 /path/sites/all/modules/contrib/rules/includes/rules.core.inc(297): FacesExtendable->__call('execute', Array) #8 /path/sites/all/modules/contrib/rules/includes/rules.plugins.inc(20): RulesExtendable->__call('execute', Array) #9 /path/sites/all/modules/contrib/rules/includes/rules.core.inc(1570): RulesAction->executeCallback(Array, Object(RulesState)) #10 /path/sites/all/modules/contrib/rules/includes/rules.core.inc(2215): RulesAbstractPlugin->evaluate(Object(RulesState)) #11 /path/sites/all/modules/contrib/rules/includes/rules.plugins.inc(216): RulesActionContainer->evaluate(Object(RulesState)) #12 /path/sites/all/modules/contrib/rules/includes/rules.plugins.inc(392): Rule->evaluate(Object(RulesState)) #13 /path/sites/all/modules/contrib/rules/includes/rules.core.inc(2215): RulesReactionRule->evaluate(Object(RulesState)) #14 /path/sites/all/modules/contrib/rules/includes/rules.plugins.inc(695): RulesActionContainer->evaluate(Object(RulesState)) #15 /path/sites/all/modules/contrib/rules/rules.module(833): RulesEventSet->executeByArgs(Array) #16 /path/sites/all/modules/contrib/rules/modules/events.inc(77): rules_invoke_event('node_update', Object(stdClass)) #17 [internal function]: rules_entity_update(Object(stdClass), 'node') #18 /path/includes/module.inc(895): call_user_func_array('rules_entity_up...', Array) #19 /path/modules/node/node.module(1180): module_invoke_all('entity_update', Object(stdClass), 'node') #20 /path/modules/node/node.admin.inc(327): node_save(Object(stdClass)) #21 /path/modules/node/node.admin.inc(301): _node_mass_update_helper('13', Array) #22 [internal function]: node_mass_update(Array, Array) #23 /path/modules/node/node.admin.inc(640): call_user_func_array('node_mass_updat...', Array) #24 /path/includes/form.inc(1465): node_admin_nodes_submit(Array, Array) #25 /path/includes/form.inc(861): form_execute_handlers('submit', Array, Array) #26 /path/includes/form.inc(374): drupal_process_form('node_admin_cont...', Array, Array) #27 /path/includes/form.inc(131): drupal_build_form('node_admin_cont...', Array) #28 [internal function]: drupal_get_form('node_admin_cont...') #29 /path/includes/menu.inc(517): call_user_func_array('drupal_get_form', Array) #30 /path/index.php(21): menu_execute_active_handler() #31 {main}
Also tried to update Twitter settings:
- Added read and write
- Added trailing slash to Callback URL
Comments
Comment #0.0
VladimirAusUpdate with Twitter settings
Comment #1
psacc CreditAttribution: psacc commentedI dug onto this one and I think the code handling the case of unsuccesfull status update has a bug:
http://drupalcode.org/project/twitter.git/blob/1b91dfa76f0f60c788ed5226d...
this code expects an exception, but receives the value created by this code:
http://drupalcode.org/project/twitter.git/blob/1b91dfa76f0f60c788ed5226d...
used by this (as pointed by the stacktrace):
Not sure how this can affect other call paths, but unsuccessful status publication to twitter triggered by rule action is actually broken.
Comment #2
psacc CreditAttribution: psacc commentedadded clarification to the title
raised priority as the issue falsely reports the action as succesful
Comment #3
juampynr CreditAttribution: juampynr commentedWhere did you find that event? When I create a rule I only see the following events related with nodes:
Comment #4
juampynr CreditAttribution: juampynr commentedAdjusted how the response is treated when there is an error. As @psacc said, no Exception is bubbled up since the call() method catches it. I have adjusted it so now it rethrows the Exception and each scenario can decide on what to do.
http://drupalcode.org/project/twitter.git/commit/1e90e0b
http://drupalcode.org/project/twitter.git/commit/31a614e
As for the Forbidden message, note that Twitter won't let you post the same tweet message twice. Make sure that your rule's pattern produces a unique tweet message.
Comment #5
juampynr CreditAttribution: juampynr commented