I'm trying to call the GetStoreItems from cloud script using:
let storeInfo = server.GetStoreItems({ "PlayFabId": currentPlayerId, "CatalogVersion": "Default", "StoreId": "ShopBux" })
or any permutation (but always keeping the required StoreId)
let storeInfo = server.GetStoreItems({ "CatalogVersion": "Default", "StoreId": "ShopBux" })
let storeInfo = server.GetStoreItems({ "StoreId": "ShopBux" })
but I keep getting a JavaScriptException with no more details
I know this call is fairly new, so maybe it is not working right, or am I doing something wrong?
P.S. The client version of this call does work.
Answer by Brendan · Sep 20, 2019 at 12:16 AM
Thanks for calling that out. The Cloud Script service is being updated now to enable the use of the new API call from scripts. We expect it'll be fully functional in script tomorrow (Friday).
Hi, I'm trying it out this morning. Still getting Javascript errors.
Hi @rlavoie, thank you for your feedback, I can also repro this JavascriptException in our test title, I just informed the team to double check the root cause. Sorry for any inconverience caused.
Hi @rlavoie, I just got the update from team, the fix should be deployed tomorrow.
Hi @rlavoie, I just verified that the GetStoreItems sever API is available in cloudscript now.
Answer by Citrus Yan · Sep 12, 2019 at 03:28 AM
Hi,
I was able to reproduce your issue that server.GetStoreItems throws JavascriptException in CloudScript, in the StackTrace it says “TypeError: server.GetStoreItems is not a function\n at handlers.getStoreItems”. I will report this to our engineering team and keep you informed of any new updates, thanks for your feedback:)
Answer by kamyker · Sep 16, 2019 at 07:28 AM
You can use this as a workaround, edit your-title and your-key in the code:
function TempGetStoreItems(storeId: string): PlayFabServerModels.GetStoreItemsResult { let url = "https://your-title-id.playfabapi.com/Admin/GetStoreItems"; let method = "POST"; let contentBody = `{"StoreId": "${storeId}"}`; let contentType = "application/json"; let headers = { "X-SecretKey": "your-key" }; let responseString = http.request(url, method, contentBody, contentType, headers); let responseJSONObj: any = JSON.parse(responseString); return <PlayFabServerModels.GetStoreItemsResult>(responseJSONObj.data); }
server.GetPlayersInSegment returns successfully, but *Empty* function result 1 Answer
server.AddSharedGroupMember returns Invalid Shared Group ID 1 Answer
Don't know how to send values to azure function via cloudscript with Unity 1 Answer
JSON Field Reformatting on Automation Save 2 Answers
Get players in segment count Via cloud script and update title data 1 Answer