question

AnthonyKim avatar image
AnthonyKim asked

Always "req.body.CallerEntityProfile" return undefined whenever i call azure function via scheduled tasks

I need a player's master id for my function.

so I use to like this "req.body.CallerEntityProfile.Lineage.MasterPlayerAccountId"

but always return "undefined" only via scheduled tasks.

what should I do about this?

scheduled tasks
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.

Gosen Gao avatar image Gosen Gao commented ·

I will do some research.

0 Likes 0 ·

1 Answer

·
Gosen Gao avatar image
Gosen Gao answered

Because Scheduled Task's request to call Azure Function is different compared to Azure Function called by the client. But the MasterPlayerAccountId is contained in the req, you can obtain it with the code below.

 string requestBody = await new StreamReader(req.Body).ReadToEndAsync();
 JObject jsonO = JObject.Parse(requestBody);
 string PlayFabId = jsonO["PlayerProfile"]["PlayerId"].ToString();

[Update]

We recommend Using CloudScript context models to access the request from Scheduled Task.

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.

AnthonyKim avatar image AnthonyKim commented ·

Thank u for ur help.
I just checked it. and it is working well for me.

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.