Search code examples
phpfacebookfacebook-graph-apienvironment

Production Environment Error: Does not resolve to a valid user id


I finished a working app that allows my user to login with Facebook then simultaneously post to their blog website and a Facebook page wall on submit. This works fine in my development environment (localhost) but when I pushed it up to production I get the following error when trying to post to the pages wall:

1.234523452345234E+14 does not resolve to a valid user ID

The number shown is almost identical to the page (not user) id of the page I am attempting to post to. I assume since you must act as the page when performing actions on the page that the page is the user. Any ideas why this would break in a new environment? I did update my app configuration to point to the correct canvas urls.

  • User can successfully login.
  • I can access the user id and page id.

I noticed the page id is getting reformatted: 12345234523452340 becomes 1.234523452345234E+14


Solution

  • Convert it back to the whole number:

    number_format(1.234523452345234E+14,0,'','')