Local Development For Heroku Facebook Apps

May 12, 2012 at 12:09 (Development, Facebook, Tech)

Disclaimer: At the moment this is mostly a brain dump because I don’t want to forget everything I seem to be having to do to get this setup

When Heroku and Facebook joined together it seemed like a great way for me to get back into development without having to worry about sorting out some new hosting and other things that I didn’t have time or money to invest in just to play around some more.

Heroku have a good getting started tutorial and sample app:  https://devcenter.heroku.com/articles/facebook

which was all going fine until “For development, you’ll need to register another app with Facebook. Unlike the first app, this one will not run on Heroku, but instead will run on your local workstation”. This did make me wonder if both Heroku and Facebook are going about things the wrong way. Shouldn’t the first step be teaching people how to develop locally and then deploy live. I’d have hoped that Facebook would do more to provide support for development versions of apps instead of manually having to duplicate everything. Interestingly I just read this blog about the lack of fundamentals in web programming education which I completely agree with.

The first problem I had was setting the facebook app env variables. This meant setting up a virtual host and was back to all the things I didn’t know about and wanted to avoid. I followed the instructions but it didn’t seem to work.

I hacked my way around this to get things working by adding the following code to the top of the AppInfo.php file


Not nice or recommended but it allowed me to make some progress.

Although not much progress, I was now getting through to Facebook but not getting much further and failing to authorise and no clues as to why. I now can’t remember the exact details but somehow debugged the code  in FBUtils/login.php to find out why nothing was returning from the CURL request (something else I knew nothing about). Turned out the problem was because the app was not being accessed via https, something all Facebook apps now need to do.

The next step was therefore to setup SSL on my local WAMP setup. I found several different articles on how to do this and tried a few all without any success. Finally I found this http://www.phpjoel.com/2011/04/07/installing-ssl-using-openssl-on-a-wamp-localhost/ which was not only the simplest example it also seemed to work.

I had to debug one final problem by running httpd from the command prompt which told me there was a syntax error on the CustomLog in httpd-ssl.conf, I added in an extra quote and everything now seemed to be working. When I say working, I mean working a little more. I could now access my localhost via https and the Facebook app was attempting to verify. Unfortunately I was now getting errors back from Facebook “API Error Description: The specified URL is not owned by the application”. From the URL it looked like this was still trying to access http rather than https and I just needed to update the configuration settings of the app. I’ve tried changing the URL but it’s still not working, I’m hoping this is just a matter of waiting several minutes to propagate to all servers but it’s been a while now and it’s still not working. Considering I first started the Heroku in February I’m pleased to finally have it working this far and will have to come back to work out what’s wrong with the configuration some other time.

Permalink 1 Comment