node:url token not returning clean (alias) URL This is a follow-up question of: How to delay the execution of a rule for 5 minutes?

When not delaying the action, the node:url token does not return the alias URL, but the URL with the token ID: ...node/id. I assumed this is because this URL is simply not available yet. I have to use the clean URL, because otherwise a scraper would get a HTTP status code 302 and is unable to scrape the page correctly.

I'm using the Pathauto module to create the URL's automatically. 

However, when using the sheduler, I'm still not getting the clean URL. These are my current settings:



The marked token in the screenshot should return the clean URL, but it returns the unclean /node/id one. I've already tried to change the token to [entity-fetched:url:path], but this seems to return an invalid URL (or no URL at all, is it possible to debug this?).

Why can't I get the clean URL using tokens in rules?

The weird thing is... if I edit a node instead of creating a new one, node:url does return the clean URL, but not when using the sheduler.

EDIT:

{ "rules_publish_to_fb" : {
    "LABEL" : "Publish to fb",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "REQUIRES" : [ "rules", "rules_scheduler", "fb_autopost_entity" ],
    "ON" : { "node_insert" : [], "node_update" : [] },
    "IF" : [
      { "node_is_of_type" : {
          "node" : [ "node" ],
          "type" : { "value" : {
              "event" : "event",
              "inspiration_theme" : "inspiration_theme",
              "news_item" : "news_item"
            }
          }
        }
      },
      { "entity_has_field" : { "entity" : [ "node" ], "field" : "field_facebook_message" } },
      { "entity_has_field" : { "entity" : [ "node" ], "field" : "field_facebook_published" } },
      { "NOT data_is_empty" : { "data" : [ "node:field-facebook-message" ] } },
      { "data_is" : { "data" : [ "node:status" ], "value" : "1" } }
    ],
    "DO" : [
      { "schedule" : {
          "component" : "rules_facebook",
          "date" : "+2 minutes",
          "param_node" : [ "node" ]
        }
      }
}


And

{ "rules_facebook" : {
    "LABEL" : "facebook",
    "PLUGIN" : "action set",
    "OWNER" : "rules",
    "REQUIRES" : [ "rules", "fb_autopost_entity" ],
    "USES VARIABLES" : { "node" : { "label" : "node", "type" : "node" } },
    "ACTION SET" : [
      { "entity_fetch" : {
          "USING" : { "type" : "node", "id" : [ "node:nid" ] },
          "PROVIDE" : { "entity_fetched" : { "entity_fetched" : "Fetched entity" } }
        }
      },
      { "entity_create" : {
          "USING" : {
            "type" : "facebook_publication",
            "param_type" : "link",
            "param_user" : [ "site:current-user" ]
          },
          "PROVIDE" : { "entity_created" : { "facebook_link" : "Facebook link" } }
        }
      },
      { "data_set" : {
          "data" : [ "facebook-link:field-facebook-message" ],
          "value" : "[node:field-facebook-message]"
        }
      },
      { "data_set" : {
          "data" : [ "facebook-link:field-facebook-link" ],
          "value" : "[entity_fetched:url]"
        }
      },
      { "publish_to_facebook" : {
          "USING" : { "publication" : [ "facebook-link" ], "pages" : "1247812435236072" },
          "PROVIDE" : { "facebook_publication_id" : { "facebook_publication_id" : "Facebook publication returned ID" } }
        }
      },
      { "drupal_message" : { "message" : "[entity_fetched:url]" } }
    ]
  }
}
Option 1 (a): Try another token

Check what result you get by using either of these tokens:


[site:current-page:url].
[node:node-path].
[node:node-url].


Option 1 (b): Pass the URL as an extra parameter

Inspired by the answer to the question "Send node path alias to user", you might be more lucky to get access to the correct value of your URL (or either of the tokens I suggested above) if you just pass that value to your Rules Component as an extra parameter (so on top of the "node" parm you already have). And of course use the value of that parameter in your Rules Component instead.

The reason why I think you may be more lucky, is that you already have that "node_is_of_type"-condition. So because of that, and similar to the answer in the above mentioned question, it should be available in your first rule in which you schedule the Rules Component.

Option 2: Perform Rules debugging

If Option 1 doesn't help, then I'd recommend you to do some further debugging of your actual rule, as detailed below (and in the order specified).

Basic debugging

Rules is great, but sometimes also tough to debug if things don't work as you'd expect. There are some typical facilities to do such debugging, but my Keep-It-Super-Simple technique I often use is my BINGO-trick. A sample of such rule can be found in my answer to "Which Rules condition can be used to email a user when an admin updates their profile?". Stupid, but simple and efficient (I think).

Debugging using Rules settings

Something else that might help to find the answer to your question, is to have a look at Rules debugging ... Within the Rules settings, experiment a bit with the debugging facilities that come with the rules module. At least have a look at the "Rules Evaluation Log" (to check that the Rules logic being executed, actually matches what you expect that logic to be).

Debugging using the Devel module

Depending on what the result of that type of debugging is, you may also want to (temporary) enable the Devel module, so that you can (temporary) add a Rules Action like "Display a value".

Video tutorial about Rules debugging

Refer to the (great!) video "Debugging rules configuration" for way more details about the last 2 variations.