question

Kain avatar image
Kain asked

Server GetTitleInternalData always returns empty data

For some reason, this cloudscript always returns empty data

var titleInternalDataRequest =
{
};
var titleInternalData = server.GetTitleInternalData(titleInternalDataRequest);
log.debug("titleInternalData", titleInternalData);

I tried it with specific keys and still get the same result. I manually set that internal data within Content->Title Data using the admin tool.

As a test, I tried calling SetTitleInternalData and that worked just fine.

I am not sure if this is really a bug or I'm just doing something wrong.

CloudScript
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

·
brendan avatar image
brendan answered

Well first, the log functionality is designed for strings, so I would change that last line to:

log.debug("titleInternalData", JSON.stringify(titleInternalData));

But otherwise, that code would work fine - testing it in my own title, it returns the Title Internal Data. If you're still not seeing that, can you please provide the Title ID and the revision of the Cloud Script you're using for the test?

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

Kain avatar image Kain commented ·

Thank you, once again, Brendan! JSON.stringify was the tool I was missing. I did not realize that log.debug's second parameter had to be a string type. The output log of empty brackets and braces looked legit enough for me to not question its veracity.

log.debug with JSON.stringify was enough to help me figure out what I did wrong. It turns out that server.GetTitleInternalData was working correctly as you said, but I was not using the result correctly.

Instead of doing

titleInternalDataResult.Data.KeyName

I erroneously skipped the Data node

titleInternalDataResult.KeyName

Apologies for this user error, Javascript is not my first language.

On a related note, is there any way to obliterate cloud revisions out of shame? Coming from a Visual Studio environment, I feel like I must be doing something wrong when every experiment I try increments the revision.

0 Likes 0 ·
brendan avatar image brendan Kain commented ·

Got it - that makes sense. We don't support deletion of revisions currently (it's meant to act more like an actual source control system in that regard), but there is a feature request for that here (https://community.playfab.com/idea/928/210862717-Removing-Cloud-Script-revision.html). "Liking" those gives us more data on how many developers any particular feature might help, for purposes of prioritization.

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.