question

cosmosark avatar image
cosmosark asked

Cannot add member to Shared Group via Server API in Cloud Script

(AddSharedGroupMembers) I cannot add a member to a Shared Group via the server API I'm trying on a cloud script. Error:

"Logs": [ { "Level": "Error", "Message": "PlayFab API request error", "Data": { "api": "/ Server / AddSharedGroupMembers", "request": { "SharedGroupId": "ExistingRooms", "PlayFabIds": [ "E813B7BAD690BBE6" ] }, "result": null,

"apiError": { "code": 400, "status":

"BadRequest", "error":

"InvalidSharedGroupId",

"errorCode": 1088, "errorMessage":

"InvalidSharedGroupId",

"errorHash": null,

"errorDetails": null }

} }, { "Level": "Info", "Message": "Error: {\" cloudScriptErrorCode \ ": \" CloudScriptAPIRequestError \ ": \" stack \ ": \" Error \\ n at Object.server_request (Script Document: 176: 24) \\ n at Object. server.AddSharedGroupMembers (Script Document: 695: 78) \\ n at handlers.saveSharedDataMembers (DC66-main.js: 306: 14) \\ n at Object.invokeFunction (Script Document: 112: 33) \ ", \" apiErrorInfo \ "{\" API \ "\" / Server / addsharedgroupmembers \ ", \" request \ "{\" sharedgroupıd \ "\" existingrooms \ ", \" playfabıds \ "[\" E813B7BAD690BBE6 \ " ]}, \ "result \" nULL \ "apierr is \" {\ "code \" 400, \ "status \" \ "BadRequest \", \ "error \" \ "ınvalidsharedgroupıd \", \ "errorcode \": 1088, \ "ErrorMessage \" \ "ınvalidsharedgroupıd \", \ "errorhash \" nULL \ "errordetails \": null}}} " "Data": null } ]

What should I do? Thank you

unity3dShared Group Data
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

·
Andy avatar image
Andy answered

The error you're getting back, InvalidSharedGroupId, means that the data you're provding in the SharedGroupId parameter of the request is bad. If you could share the title id and the value you're passing in, I can help you validate.

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

cosmosark avatar image cosmosark commented ·

Title ID: DC66
SharedGroupId: ClanMemberList

in Cloud Script:

handlers.saveSharedDataMembers = function (args) { try{

server.AddSharedGroupMembers({

SharedGroupId : args.SGDType, PlayFabIds : [args.SPI] });

server.WriteTitleEvent({ EventName : "saveSharedDataMembers" });

return { ResultCode : 0, Message: 'Success' };

}catch(e){ var msg = "Error saveSharedDataMembers: " + JSON.stringify(e); log.info(msg); } };

0 Likes 0 ·
Andy avatar image Andy ♦♦ cosmosark commented ·

Did you ever call CreateSharedGroup for that group or create in the game manager? I'm not able to find it for your title, which explains the error.

0 Likes 0 ·
cosmosark avatar image cosmosark Andy ♦♦ commented ·
<br><div></div> 1321/5000 Şu dilden çevir: İngilizce First I'm triggering this function from Unity:PlayFabClientAPI.ExecuteCloudScript (new ExecuteCloudScriptRequest (){FunctionName = "createSharedDataMembers",FunctionParameter = new{SGDType = _SharedGroupId},GeneratePlayStreamEvent = true}, OnCreateSuccess, OnErrorShared);
Later in Cloud Script:handlers.createSharedDataMembers = function (args) {try {server.createsharedgroup ({SharedGroupId: args.SGDType});server.writetitleevent ({EventName: "createSharedDataMembers"});return {ResultCode: 0, Message: 'Success'};} Catch (e) {var msg = "Error createSharedDataMembers:" + JSON.stringify (e); log.info (msg);}};
0 Likes 0 ·
Show more comments

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.