Account creation failure root cause analysis

A few people reported to me they couldn’t create an account in my app recently.  After updating the Cloud Code to having more logging I saw the error.

{"code":206,"message":"Parse::UserCannotBeAlteredWithoutSessionError"}

This was happening in an afterSave hook on Parse.User, which was saving the user object again with an additional property. It seems the new Parse Session functionality (see http://blog.parse.com/announcements/announcing-enhanced-sessions/) has added this restriction in the cloud code.

The solution was to use the master key by calling Parse.Cloud.useMasterKey() before saving the user object.