question

Jason F avatar image
Jason F asked

"InternalServerError" When executing a cloud script (Server.RemoveGenericID)

Hello,

I'm trying to remove a generic id of a player using server api via cloud script.

Here's the code I'm using online:

handlers.rGenericID = function(args, context)
{
    try
        {
            var result = server.RemoveGenericID({PlayFabID: args.ID, GenericId: args.GID})
        }
        catch(e)
        {
            var msg = "Error: " + JSON.stringify(e);
            log.info(msg);
        }
}

But I'm receiving the following error (in the data explorer):

"apiError": {
                        "code": 500,
                        "status": "InternalServerError",
                        "error": "InternalServerError",
                        "errorCode": 1110,
                        "errorMessage": "An unexpected error occured while processing the request."

What can I try to do to fix this error?

Thank you very much for your help.

CloudScript
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.

Rick Chen avatar image Rick Chen ♦ commented ·

I have tried the code you provided in my CloudScript, it works. I cannot reproduce the issue you described. Could you please provide the request body of executing the CloudScript? Have you checked this document: RemoveGenericID to set the request body?

1 Like 1 ·
Jason F avatar image Jason F Rick Chen ♦ commented ·

Hi Junjin,

Thank you very much for your reply.

Yup, I did set the request body, this is my code in Untiy:

GenericServiceId genericServiceId = new GenericServiceId
            {
                ServiceName = "GooglePlayGames",
                UserId = PlayGamesPlatform.Instance.localUser.id
            };


ExecuteCloudScriptRequest executeCloudScriptRequest = new ExecuteCloudScriptRequest
                {
                    FunctionName = "rGenericID",
                    FunctionParameter = new { GID = genericServiceId, ID = onlinePlayer.id.Value},
                    GeneratePlayStreamEvent = true
                };

                PlayFabClientAPI.ExecuteCloudScript(executeCloudScriptRequest, result =>
                {}, OnPlayFabFailure);
0 Likes 0 ·
Rick Chen avatar image Rick Chen ♦ Jason F commented ·

I have done a test using your code in Unity, it again worked, and I still cannot reproduce the error you mentioned. You mentioned that you discovered the error in Data explorer, does the error you mentioned relate to the player_executed_cloudscript event of your “rGenericID” function? Could you please provide your title Id and the event Id of the error event for us to diagnose?

1 Like 1 ·
Show more comments
Show more comments
Jason F avatar image Jason F Rick Chen ♦ commented ·
ID = onlinePlayer.id.Value

This return a string, just thought I mention this just in case. :)

0 Likes 0 ·

1 Answer

·
Jason F avatar image
Jason F answered

Thank you @Junjin Chen for the help and the tips!

Inspired by your answer, I went on and changed the ID I've been using and it seemed the the problem was solved.

I was using the Player ID(title) and that was the problem, I used the Player ID from the master player account and it worked.

Thank you again!

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.

Rick Chen avatar image Rick Chen ♦ commented ·

I am glad that you spotted it out and fixed the issue. If you have any further questions, please feel free to ask.

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.