question

giorgiotino avatar image
giorgiotino asked

playfab.profile.language_updated and entity_language_updated difference and how to create custom rules to handle language change

I am pretty sure that up to some months ago I was able to handle the

playfab.profile.language_updated

triggering a cloudscript method using a rule to Execute Entity Cloud Script and specifying my cloudscript handler function.

This rule does not seem to work anymore, and my event handler for playfab.profile.language_updated is never called. I tried by setting the language manually on the web interface and by calling the Profile/SetProfileLanguage API, but no luck.

I do see an entity_language_updated getting triggered in both cases, but the function for the rule on playfab.profile.language_updated is not triggered.

Is this the right event?

Has something changed or am I missing something here?

entities
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

·
Rick Chen avatar image
Rick Chen answered

I have tested this situation on my title in the following steps:

  1. Create a cloudscript.
  2. Create a rule with event type playfab.profile.language_updated and action of calling the cloudscript in previous step.
  3. Create an account and call SetProfileLanguage API.

It successfully updated the profile language with the language_updated event generated and the action was triggered and the CloudScript was executed.

playfab.profile.language_updated is the right event relating to SetProfileLanguage API. The reason that your calling SetProfileLanguage API not trigging any event could be that you are trying to update the same language as your profile’s language. Could you please update to a different language and check again?

If the issue still occurs, please provide your title id for us to diagnose.

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.

giorgiotino avatar image giorgiotino commented ·

I think I found the problem: such event calls ExecuteEntityCloudScript and not ExecuteCloudScript, so the content of context is completely different. I was using the context in the same way I do in other event handlers without noticing that for such event/rule the only option was the "Entity" version of the cloudscript function...

The event was indeed triggered, but it would just fail.

I have another question at this point: I tried to figure out what was wrong but I could only get a generic Action Failed with a 1187 error (Third party error) and I could see that some Javascript exception was thrown, but I couldn't print any log (or I wasn't just able to find them?) nor get a more descriptive message for the exception.

does logging work differently in playstream event triggered functions? how can I debug them?


0 Likes 0 ·
Rick Chen avatar image Rick Chen ♦ giorgiotino commented ·

The PlayStream event triggered functions will also generate events. You could find those events and logs in your title->Data-> Event History or using data explorer. From your description we could not determine the issue. Could you please provide the code snippet of your function that is triggered by event?

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.