question

yagiFM31 avatar image
yagiFM31 asked

About Azure Functions Code(C#) Error

I'm trying to use this code.(https://community.playfab.com/questions/48099/call-incrementplayerstatisticversion-from-azure-fu.html)

I would like to use this code to reset the leaderboard.

However I can't figure out how to use this code.

Please tell me the detailed usage.

I'm writing code in C# using Visual Studio Code.

I was able to register the sample code with Azure Functions instead of this code.

However, when I write this code in Visual studio code, I get error in "HttpRequestMessage" and "FunctionContext<dynamic>".

*Output log is here.

H:\yagisawa\VisualStudioCode\Project\ResetLeaderBoardTest.cs(21,73): error CS1031: 型が必要です [H:\yagisawa\VisualStudioCode\Project\Project.csproj] H:\yagisawa\VisualStudioCode\Project\ResetLeaderBoardTest.cs(21,73): error CS1001: 識別子がありません [H:\yagisawa\VisualStudioCode\Project\Project.csproj] ターミナル プロセス "C:\Program Files\dotnet\dotnet.exe 'publish', '--configuration', 'Release', '/property:GenerateFullPaths=true', '/consoleloggerparameters:NoSummary'" が終了コード 1 で終了しました。

Leaderboards and Statistics
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

·
Citrus Yan avatar image
Citrus Yan answered

May I have the exact code snippet you're using that encounters this error?

22 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.

yagiFM31 avatar image yagiFM31 commented ·

I'm sorry, this issue has been resolved, but I have other issue. I can register C # code with Azure Function and register it with CloudScript However, when I execute Azure Functions registered in CloudScript with scheduled task, it always fails. I want to know the cause of this.

0 Likes 0 ·
scheduled-task.png (58.6 KiB)
Citrus Yan avatar image Citrus Yan yagiFM31 commented ·

Please navigate to [Game Manager] -> [Data] -> [Data Explorer(basic)] to query the title_completed_task event, where you can find all the details regarding the failure. Please check out this tutorial to learn how to use DataExplorer basic to query: Getting started with Data Explorer basic mode - PlayFab | Microsoft Docs

0 Likes 0 ·
yagiFM31 avatar image yagiFM31 Citrus Yan commented ·

thank you for response.

I queryed title_completed_task, but I can't understand to mean this message.

Please tell me to mean this message and how to resolve issue.

0 Likes 0 ·
Show more comments
yagiFM31 avatar image yagiFM31 commented ·

Thank you for response and taking your time.

It's alright.

Could you tell me how to resolve issue.

0 Likes 0 ·
data-explore.png (19.6 KiB)
Citrus Yan avatar image Citrus Yan yagiFM31 commented ·

This error indicates that the size of the response from the "testFunc“ Azure Function is too big, may I know how many bytes were returned from your Azure Function?

0 Likes 0 ·
yagiFM31 avatar image yagiFM31 Citrus Yan commented ·

I don't know how to get the number of bytes returned.

I use this code.

https://community.playfab.com/questions/48099/call-incrementplayerstatisticversion-from-azure-fu.html

Can you get it from this code?

0 Likes 0 ·
Show more comments
yagiFM31 avatar image yagiFM31 commented ·

Sorry, I can't understand "snippet code", because I'm programing beginner.

Could you tell me "snippet code"?

I'm using C# on Visual studio.

This is the code I'm using code.

0 Likes 0 ·
code.png (37.2 KiB)
Citrus Yan avatar image Citrus Yan yagiFM31 commented ·

"Code snippet" means a small region of re-usable source code, which is exactly the one you provided, thanks! I will try to reproduce your issue and keep you posted for any updates.

0 Likes 0 ·
Citrus Yan avatar image Citrus Yan Citrus Yan commented ·

I did a test based on your code, and from the result everything looks good:

{
    "EventName": "title_scheduled_function_executed",
    "Source": "CloudScriptAzureFunctions",
    "ScheduledTask": {
        "Name": null,
        "Id": null
    },
    "FunctionName": "ResetLeaderboard",
    "FunctionExecutionResult": {
        "ExecutionTimeMilliseconds": 916,
        "FunctionName": "ResetLeaderboard",
        "FunctionResult": {
            "result": {
                "statisticVersion": {
                    "activationTime": "2021-05-06T08:34:37.99Z",
                    "archiveDownloadUrl": null,
                    "deactivationTime": null,
                    "scheduledActivationTime": null,
                    "scheduledDeactivationTime": null,
                    "statisticName": "foo",
                    "status": 0,
                    "version": 4
                }
            }
        },
        "FunctionResultTooLarge": null,
        "Error": null
    },
    ...
    }
}

0 Likes 0 ·
Citrus Yan avatar image Citrus Yan yagiFM31 commented ·

This is the code I was using:func.txt

0 Likes 0 ·
func.txt (1.5 KiB)
yagiFM31 avatar image yagiFM31 Citrus Yan commented ·

Thank you for trying it.

I'll try this code.

What is "TitleId" and "DeveloperSecretKey"?

Where can I refer to it?

0 Likes 0 ·
Show more comments
yagiFM31 avatar image yagiFM31 commented ·

I tried it, but I got same error.

If the code is correct, do you find what's wrong?

Thank you for taking your time.

0 Likes 0 ·
Citrus Yan avatar image Citrus Yan yagiFM31 commented ·

I was not able to see the same error on my side though, do you mind sharing your function url for us to investigate?

0 Likes 0 ·
yagiFM31 avatar image yagiFM31 Citrus Yan commented ·

It's alright. This is the function url.

https://leaderboardresetfunction20210507.azurewebsites.net

0 Likes 0 ·
Show more comments
yagiFM31 avatar image yagiFM31 commented ·

Thank you for teaching.

However I can't find this url.

Where can I refer to it?

0 Likes 0 ·
Citrus Yan avatar image Citrus Yan yagiFM31 commented ·

Please go to the portal of your Azure Function app, navigate to the "Functions" sections, then click the function of which you want to get the URL:

0 Likes 0 ·
1.png (35.7 KiB)
2.png (31.5 KiB)
yagiFM31 avatar image yagiFM31 Citrus Yan commented ·

Thank you for telling me.

When I ran it again with the URL I was told, it worked I want to do.

Thank you so much for a long time.

If you have trouble again, I'll ask here.

0 Likes 0 ·
Show more comments

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.