We're setting up a cloudscript to retrieve location data from a player login/account creation and make it available in player publisher data. We only need the most recent location and have been having trouble getting it set up properly.
Initially we had a rule that on login we would migrate the data, but as one might expect this opened us up to a race condition between playfab and our data pull-down.
Later we attempted to modify this to manually run a cloud script function as soon as the login resolved correctly. The function involves the following call:
var profile = server.GetPlayerProfile( {PlayFabId: currentPlayerId, ProfileConstraints: {ShowLocations: true}} ); regInfo["LatestLocation"] = JSON.stringify(profile.PlayerProfile.Locations[0]);
Unfortunately it appears we have a similar issue. Sometimes the GetPlayerProfile call, despite having the login occur and resolve, hits a null profile 'Profile not found' error when logging in as a first-time-user.
In regards to this post (https://community.playfab.com/questions/19784/new-user-playfabclientapigetplayercombinedinfo-inf.html) it is suggested to sleep the invocation, but that's not really ever an airtight solution.
Is there no way to enforce completion of the player profile before the call? We were expecting that an account creation would return correctly once a player was created and anticipated that this would include the creation of a profile. For our use case we need to be able to guarantee a location pull.