question

David James avatar image
David James asked

Server/GrantCharacterToUser User Not Found

CloudScriptAzureFunctionsHTTPRequestError - /CloudScript/ExecuteFunction: Invocation of cloud script function RequestCharacter failed with HTTP status BadRequest and response body {"httpCode":400,"httpStatus":"BadRequest","error":1001,"errorMessage":"User not found","errorDetails":null,"requestId":"1-64c0afd5-262c3f2f001dda78742d117e","retryAfterSeconds":null}

After lots of trial and error this message is quite persistent, and I'm beginning to believe "User not found" is more in relation to the character itself not existing in playfab's database than the user itself.

Why? Because at this point I've hardcoded my requesting EntityId obtained via login result in both server azure function and client unity, and set type to title_player_account- the user exists.

https://community.playfab.com/questions/468/206796877-Character-creation-Server-Client-differences.html

In the above post it is mentioned for Server API:

You just grant the character to the player.

but fails to mention what exactly that means.. Here there is an example how to grant a character, but again this terminology is not explained well at all. https://community.playfab.com/questions/40687/could-someone-just-post-cloud-script-showing-how-t.html What is a character to playfab? without pointing me to this document: https://learn.microsoft.com/en-us/rest/api/playfab/server/characters?view=playfab-rest Could it be explained, what exactly is a character if it's not being sourced from the economy tab as an item?
apisCloudScriptCharacters
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Xiao Zha avatar image
Xiao Zha answered

The Server/GrantCharacterToUser API needs a PlayFabId which is the master_player_account Id not the title_player_account Id, you can refer to Available Built-In Entity Types - PlayFab | Microsoft Learn to have more information about master_player_account. And when you call Server API to grant a character to player, PlayFab will generate a character for you and character is a sub-entity of title_player_account.

1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

David James avatar image David James commented ·

@Xiao Zha I've tried that in the client request, but I receive:

InvalidEntityType - /CloudScript/ExecuteFunction: Entity must be of type title or lower.

Or if I'm understanding right the client code is fine, and should be title_player_account- but the server needs the requesting player's master id. In which case I could pass it off in the param?

Thank you for your time I've been really struggling with this.

Edit: After some struggling I realized I was entering the wrong ID completely .

EntityID, PlayFabID, Title Player Account ID, Master Player Account ID etc.. it can get confusing.

1 Like 1 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.