Can not perform this operation before game start


#1

I’ve been following the demo on the site for Facebook Instant, but I can’t seem to get the basics working. It all works on Facebook’s side, and I have localhost testing setup correct as per Facebook’s guidelines (with openssl).

Here’s my stripped down code:

function create() {
    this.facebook.once('startgame', function() {
        console.log('Started')
    }, this)
    this.facebook.gameStarted();
}

FBInstant.initializeAsync()
    .then(function () {
        new Phaser.Game({
            type: Phaser.AUTO,
            width: window.innerWidth,
            height: window.innerHeight,
            scene: {
                create,
            }
        })
    })

The error I get in the console when loading the game in Facebook is:

{code: "INVALID_OPERATION", message: "Can not perform this operation before game start."}

Any ideas why this might be?