Sign In Register

How can we help you today?

Start a new topic

Spark.getPlayer() results in null

I am getting a number of fatal errors all with this same log message. This is from a cloud code script that set's the players default account stats. 


{"stackTrace":"\tat modules/SetDefaultAccountStats.js:10 (SetDefaultStats)\n\tat response/AuthenticationResponse.js:13\n","error":"TypeError: Cannot call method \"getScriptData\" of null (modules/SetDefaultAccountStats.js#10)","script":"AuthenticationResponse"}


This doesn't seem to cause any issues as I don't see any playerID associated with this log entry but it's been coming up daily. 


In the AuthenticationResponse you should check for errors. When the authentication fails (password wrong, cannot switch social accounts etc.) GS still executes the response but has no player (since the auth failed).

You can check for errors with:

 

Spark.getData().error

 

Thank you!

Login to post a comment