Sign In Register

How can we help you today?

Start a new topic

When a Cloud Code script fails, in some cases, it will not produce an error response

For example, I had this bad code in a Response handler:

Spark.getPlayer.setScriptData("datafrom", "player.setScriptData");

 `getPlayer` should be a function call.


There's no message from the platform indicating this is a problem.



1 person has this problem

Added to our bug fixing pipeline.
Thanks for bringing all of this to our attention Nick.

Hi Nick,

When trying to run this in the Test Harness, I receive the following error in the debugger:

"TypeError:Cannot find function setScriptData in object function getPlayer() {/* com.gamesparks.scripting.SparkPlayer getPlayer() */} ."

As the error is reported, I'm not sure what problem you're trying to report.

 

If you run it without the debugger (or just hit continue), there's no indication that the cloud code failed; you still get a response that looks fine.


Compare when the same thing happens in a request handler. It responds with: 


{
 "@class": ".GameSparksErrorResponse",
 "error": {
  "message": "org.mozilla.javascript.EcmaError: TypeError: Cannot find function setScriptData in object function getPlayer() {/*\ncom.gamesparks.scripting.SparkPlayer getPlayer()\n*/}\n. (294860-request-ListAchievementsRequest#54817)",
  "errorInstanceId": "69eb52bc-16c8-4e50-8478-17c32356ee0d"
 },
 "message": "org.mozilla.javascript.EcmaError: TypeError: Cannot find function setScriptData in object function getPlayer() {/*\ncom.gamesparks.scripting.SparkPlayer getPlayer()\n*/}\n. (294860-request-ListAchievementsRequest#54817)",
 "scriptData": null
}

This is in ListAchievements* if you want to take a peek.


I'm not totally sure what I want here, but at the very least, the harness should be notified that an error happened. Probably the client should too. But the error data above might be sensitive (maybe this is only the case in Preview mode?). A 5xx HTTP code would be appropriate I'd say.


1 person likes this

I am getting the same issue as above:


From Unity, it's returning this error:


"TypeError: Cannot find function throwErr in object com.gamesparks.scripting.impl.SparkImpl@726cd33."


However, when I run it from debugger, I get this:


Error performing POST form for the URL https://partner.steam-api.com/ISteamMicroTxnSandbox/InitTxn/v3/:partner.steam-api.com:443 failed to respond


(and I don't actually see that throwErr type err response anywhere while debugging)


Possibly Related:


https://support.gamesparks.net/support/tickets/6646

https://support.gamesparks.net/support/discussions/topics/1000085926?page=1

Login to post a comment