Okay I might be wrong, but I'm getting almost everything working, it posts to Facebook on 'new content saved rule' triggered. But it gives URL with title Page Not Found, but the URL does work when clicked.

But if you go to your website's logs, it shows that before every new content created, an anonymous tried to visit a page that does not exist aka same page you are creating.

So as I understand for some reason if you create new page with node/1, before it's saved, Facebook API visits your site for node/1 and since it does that before the content was saved, Drupal logs bounce back 'Page not found' error and then Facebook API pulls that title to the Facebook post.

a

As you can see the node got created only after Anonymous already tried to visit the URL.

My Rule is set to 'After content saved/created'.

CommentFileSizeAuthor
Recent log messages hello world.png7.83 KBvibrasphere
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

vibrasphere created an issue. See original summary.

vibrasphere’s picture

Issue summary: View changes
sarathkm’s picture

I am facing similar issue right now with facebook showing 404 pages but works when clicked and goes to the page. This has been reported in stackexchange (here) last year by someone and tried using rules scheduler so that it post after sometime but with no success as it does has authentication issue with Facebook.

I am looking solution for the same. My Problem

Separate rule for updating works fine.

If you have solution please do share.

sarathkm’s picture

Ok thing got started working for me.

Schedule rules to rule after few minutes delay to post to facebook and we get the correct result.

Solution on stack exchange (well not exact solution)

guvser’s picture

Same problem here.. worked perfect until July 18.

sarathkm’s picture

I have seen same problem in some other websites too. It seem facebook is crawling data faster than the time taking it to get published.

WebWalker3D’s picture

following - also have same issue. FB hits twice before the content is even published.

guvser’s picture

Possible workaround that worked for me:
I re-created the rules settings in "Rules Links" module, which inserts a button on the newly created node. By clicking, the rule is activated and the node is pushed out on facebook. It obviously requires a manual action from the editor once created, but works.

lazzyvn’s picture

can you guide me clearly please. i have same issue.
Can you share export your rule please
edit : i got here
https://drupal.stackexchange.com/questions/193399/nodeurl-token-not-retu...

{ "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]" } }
    ]
  }
}
styrbaek’s picture

I'm using rules schedule to get by this problem.