Microsoft Azure PlayFab logo
    • Multiplayer
    • LiveOps
    • Data & Analytics
    • Add-ons
    • For Any Role

      • Engineer
      • Designer
      • Executive
      • Marketer
    • For Any Stage

      • Build
      • Improve
      • Grow
    • For Any Size

      • Solo
      • Indie
      • AAA
  • Runs on PlayFab
  • Pricing
    • Blog
    • Forums
    • Contact us
  • Sign up
  • Sign in
  • Ask a question
  • Spaces
    • PlayStream
    • Feature Requests
    • Add-on Marketplace
    • Bugs
    • API and SDK Questions
    • General Discussion
    • LiveOps
    • Topics
    • Questions
    • Articles
    • Ideas
    • Users
    • Badges
  • Home /
  • Bugs /
avatar image
Question by rlavoie · Sep 12, 2019 at 01:53 AM · CloudScript

GetStoreItems throws JavascriptException in CloudScript

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.

Comment

People who like this

0 Show 0
10 |1200 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

4 Replies

· Add your reply
  • Sort: 
avatar image
Best Answer

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

Comment

People who like this

0 Show 5 · Share
10 |1200 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image rlavoie · Sep 23, 2019 at 01:55 PM 0
Share

Hi, I'm trying it out this morning. Still getting Javascript errors.

avatar image FranklinChen rlavoie · Sep 24, 2019 at 01:25 AM 0
Share

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.

avatar image FranklinChen rlavoie · Sep 24, 2019 at 01:53 AM 1
Share

Hi @rlavoie, I just got the update from team, the fix should be deployed tomorrow.

avatar image FranklinChen rlavoie · Sep 26, 2019 at 01:14 AM 1
Share

Hi @rlavoie, I just verified that the GetStoreItems sever API is available in cloudscript now.

Show more comments
avatar image

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:)

Comment
rlavoie

People who like this

1 Show 0 · Share
10 |1200 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image

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);
}
Comment
Citrus Yan

People who like this

1 Show 0 · Share
10 |1200 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image

Answer by rlavoie · Sep 26, 2019 at 04:05 PM

It is now working as intended. Thanks!

Comment

People who like this

0 Show 0 · Share
10 |1200 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Navigation

Spaces
  • General Discussion
  • API and SDK Questions
  • Feature Requests
  • PlayStream
  • Bugs
  • Add-on Marketplace
  • LiveOps
  • Follow this Question

    Answers Answers and Comments

    3 People are following this question.

    avatar image avatar image avatar image

    Related Questions

    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

    PlayFab

    • Multiplayer
    • LiveOps
    • Data & Analytics
    • Runs on PlayFab
    • Pricing

    Solutions

    • For Any Role

      • Engineer
      • Designer
      • Executive
      • Marketer
    • For Any Stage

      • Build
      • Improve
      • Grow
    • For Any Size

      • Solo
      • Indie
      • AAA

    Engineers

    • Documentation
    • Quickstarts
    • API Reference
    • SDKs
    • Usage Limits

    Resources

    • Forums
    • Contact us
    • Blog
    • Service Health
    • Terms of Service
    • Attribution

    Follow us

    • Facebook
    • Twitter
    • LinkedIn
    • YouTube
    • Sitemap
    • Contact Microsoft
    • Privacy & cookies
    • Terms of use
    • Trademarks
    • Safety & eco
    • About our ads
    • © Microsoft 2020
    • Anonymous
    • Sign in
    • Create
    • Ask a question
    • Create an article
    • Post an idea
    • Spaces
    • PlayStream
    • Feature Requests
    • Add-on Marketplace
    • Bugs
    • API and SDK Questions
    • General Discussion
    • LiveOps
    • Explore
    • Topics
    • Questions
    • Articles
    • Ideas
    • Users
    • Badges