question

erik-wagner avatar image
erik-wagner asked

GrantItemsToCharacter results in Internal Server Error

Hi, I am attempting to run the snippet below in my cloud script but am getting a status 500 internal server error. I'm guessing I've got some sort of problem with the syntax of the grant items to character call but I'm not certain. Is the format I have it in correct? Is there some step needed after granting a character but before granting items to them? Thanks in advance for any insight/help!

 var grantCharacter = server.GrantCharacterToUser({
      PlayFabId: currentPlayerId,
      CharacterName: "My Empire",
      CharacterType: "Empire"
    });
  log.debug(grantCharacter.CharacterId);
  var charId = grantCharacter.CharacterId;
var grantItems = server.GrantItemsToCharacter({
      PlayFabId: currentPlayerId,
      CharacterId: charId,
      ItemsIds: ["Planet", "Slot"]
    });


apisCloudScript
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

·
pfnathan avatar image
pfnathan answered
6 comments
10 |1200

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

erik-wagner avatar image erik-wagner commented ·

@pfnathan Thank you for your reply but that doesn't really clarify things for me. That post contains a link to the api documentation for GrantItemsToCharacter, which is where I originally got my information that I used to write that snippet. When I tried the 'try it' button on the documentation page for the API call it went through (though failed for different reasons). Do I need to somehow include the developer secret key on that call? I thought it was handled through the 'server' object.
Basically, what am I missing on the GrantItemsToCharacter call or what is needed preceding that that I have not included?
The flow I am using is
1. Player is created
2. Character is granted
3. Grant Items to Character
Is there some step that needs to be made between 2 & 3?
Thanks

0 Likes 0 ·
pfnathan avatar image pfnathan ♦ erik-wagner commented ·

Can you send us a "Request ID" please? thanks.

0 Likes 0 ·
erik-wagner avatar image erik-wagner pfnathan ♦ commented ·

@pfnathan, 482ea2e2a4794ebaa7a23fbc7082507f - I'm sure it is something very easy/simple I'm getting wrong but I'm just not seeing it at this point. Thanks!

0 Likes 0 ·
Show more comments
erik-wagner avatar image erik-wagner commented ·

@pfnathan, holy cow I'm an idiot. That was it, the "ItemsIds" versus "ItemIds" in the call. I must have starred at that forty times. Thanks for the eagle-eyes!

0 Likes 0 ·
pfnathan avatar image pfnathan ♦ erik-wagner commented ·

Thanks, Let us know if you are having any other issues.

0 Likes 0 ·

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.