question

brendan avatar image
brendan asked

Unexpected token StartObject error from Cloud Script

Question from a developer:

In testing my Cloud Script, I'm getting back an error with the ValidationError details "Error reading string. Unexpected token: StartObject. Path 'Logs[0].Message', line 1, position 74." What can cause this?

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

The issue is that an attempt is being made to log something which isn't a string. For example, if your code does something like this:

 

var response = server.GetUserAccountInfo(
{ "PlayFabId": currentPlayerId }
);

log.info(response);

That would cause this error. The fix is to change the log line to:

 

    log.info(JSON.stringify(response));

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

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.