question

team avatar image
team asked

Debugging and CloudScript

Hi there,

I've begun working with CloudScript over the last few days and am discovering that it can be a bit of a black box as far as debugging is concerned. At the moment, I am integrating Photon into our project and am working with the standard Photon webhooks. Long story short, I was executing a method within one of these handlers that was causing execution to halt entirely. I could tell that it was halting because my call to WriteTitleEvent was no longer firing and the event was conspicuously missing from PlayStream.

I've seen that calling the various log methods is the currently recommended approach to debugging in CloudScript, but in situations like the above where execution fails completely, I wasn't able to rely on writing these logs. I was surprised to find that wrapping the offending method call in a try/catch block in an attempt to log the output was also unsuccessful, only when I removed the method entirely did execution resume.

For that matter, even when execution is successful I'm not entirely sure of where to retrieve these logs when it is the Photon webhooks that are calling into the handlers...

In previous forum posts from one and two years ago, I saw mention of advanced CloudScript debugging options to be discussed "in the coming weeks." Has any progress been made on this front? Are there alternative options for testing locally that I might be able to explore? Any help would be greatly appreciated!

Kyle

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.

brendan avatar image
brendan answered

When using Photon, the key thing to know is that any error response coming back from the webhook call will be returned by Photon to the client that triggered it, so you can evaluate the data coming back there, in order to determine the cause.

Additional debugging options for Photon is something we do want to provide, but I'm afraid we were being overly optimistic if we said "in the coming weeks", as it's pretty much impossible to say for sure when something will be implemented, unless either a) it's currently in development, or b) we have a contract with someone that specifies a date when the feature is required. The problem is that as a live service, we have to adapt to what's happening with the service in realtime. We still make sure to prioritize work that is targeted at the long-term success of the service, and things that bubble up from the community, but this hasn't been an item that has had a large volume of requests, so it hasn't made its way to the top of the list.

For the specific issue you were seeing, can you point me to the method in question, so that I can have a look?

10 |1200

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

team avatar image
team answered

That's fair enough. I did see just before reading your response that I can get visibility into the errors that occur. That coupled with the debug logs should be fine enough for now.

How would I be able to see the errors and logs from the handlers that are called by the default Photon webhooks, like handlers.RoomJoined? I'm using a Photon App ID that's derived from the the PlayFab Photon addon; in Unity I'm using PUN and making my calls using PhotonNetwork.JoinRoom, etc. As far as I can see, there's some stuff happening behind the scenes after the request comes back successfully but before the Photon NetworkingPeer receives the event indicating as such, and I can't access it through the debugger since it's part of the Photon library. I know you can't speak for Photon's product but I'm hoping you might have some insight. I saw that you had provided an answer in the past regarding Photon's custom webhooks, but I haven't seen anything regarding the webhooks that are called once you integrate Photon with PlayFab.

As for the issue, it was happening in the handlers.RoomJoined handler but the method itself is long gone. More than likely something was lost in translation after transpiling my Typescript.

1 comment
10 |1200

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

brendan avatar image brendan commented ·

RoomJoined is called as a result of a player joining a room, so an error return from the script should be passed back to the client. If you're not seeing it, you're correct that you'll need to work with the Exit Games team (the folks who created and provide support for Photon) to determine how to make sure you're getting that info. While we have provided some advice on usage in the past, it's really best for you to talk to the owners of the tech, since they know it best.

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.