Whenever I delve into development on the Facebook platform I run into new unexplored wtf head scratching territory. Today’s experience may take the cake. The last while I had a really weird persistent bug: Some AJAX server calls would get called by the Facebook server exactly three times, instead of one. Not two times, or four times, but three. Is Facebook a Monty Python Holy Grail fan? I figured not. I was probably calling something extra, somewhere, somehow.
Yesterday I put some effort into it, and found a single post on the developer discussion forums that explained the situation. It turns out, if your script doesn’t return anything Facebook will call the script three times. If it does return something Facebook will only call it once.
What?
You mean if my script causes something to happen on the server and doesn’t need to return anything to the app… a totally reasonable scenario, Facebook will make the decision of calling my script THREE TIMES?
This makes no sense, and as far as I can tell is not documented anywhere. Please Facebook, you are packed full of smart people. I know you can fix these things.