question

Yael Beaufort avatar image
Yael Beaufort asked

Server-side cloud script is not executed

Hi! I'm trying to implement a leveling system in our game using the unreal marketplace plugin.

At the end of a game, I want to update the players' experience and other statistics so I call a cloudscript function using the Server API node 'ExecuteCloudScript'.
The problem is the script is never executed when testing on a dedicated server.

Unfortunately I can't ge unreal to write the log file to the right folder (even when running with -ABSLOG=<log_file_path>), so I'm not sure about what's happening.

I tried the same logic using the Client API node 'ExecuteCloudScript' and it worked without any problem.
I'm guessing there's some initialization code I'm missing. When running the dedicated server on playfab, I only call the 'SetPlayFabSettings' node to set the title ID and the secret API key.

What do I need to do to successfully use the node 'ExecuteCloudScript' from the Server API?

unreal
10 |1200

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

Citrus Yan avatar image
Citrus Yan answered

It looks like PlayFab service and your server can not verify each other's certificates. Turning off verification or upgrade libcurl to the newest version might work, see also:https://stackoverflow.com/questions/14682894/getting-error-in-curl-peer-certificate-cannot-be-authenticated-with-known-ca-c

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.

Citrus Yan avatar image Citrus Yan commented ·

Hi @Element808, any ideas about this?

0 Likes 0 ·
Yael Beaufort avatar image Yael Beaufort commented ·

Turning off the Verify Peer option in unreal solved it! Thank you :)

0 Likes 0 ·
Lewis Mohr avatar image
Lewis Mohr answered

This doesn't answer your cloud script question, but I was able to work around the logging issue by creating an output redirector to create a second log in the correct location:

FString ServerLogDirectory = <query the GSDK for GSDK::LOG_FOLDER_KEY>
FString ServerLogPath = FPaths::Combine(ServerLogDirectory, TEXT("MyServerLog.log"));
FOutputDeviceRedirector::Get()->AddOutputDevice(new FOutputDeviceFile(*ServerLogPath));

This will log all future log messages to the new log file, so I do this early in the process.

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

Yael Beaufort avatar image Yael Beaufort commented ·

Thanks! I'll try this with the next build I upload :)

Edit: that did the trick, I can get my logs from playfab's archive now!

1 Like 1 ·
Citrus Yan avatar image Citrus Yan commented ·

@Lewis Mohr, @Yael Beaufort This sounds like a issue, can you provide the repro steps for us to investigate? Thanks.

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

Sure. Currently this is what I do in the dedicated server code:

After the engine initializes, in the C++ part I call

IPlayFabModuleInterface::Get().GetServerAPI()->SetTitleId(TEXT("F0E72"));
IPlayFabCommonModuleInterface::Get().SetPlayFabApiSecretKey(PLAYFAB_API_SECRET_KEY);


Then in the blueprints I call the 'Set Play Fab Settings' node with the same TitleId and Secret API key.
The game's initialization continues and the GSDK's 'readyForPlayers' function is eventually called.
The players join the server via the matchmaking (We're using Servers 2.0 by the way) and play the game normally.
When the game is over, the server then calls the blueprint node 'ExecuteCloudScript' for all players using the Server API. And this is where the issue seems to be.

I managed to connect to the virtual machine after testing this process, got unreal's logs and found a crash in the HttpManagerThread a little after the ExecuteCloudScript requests are sent.
I'm uploading this part of the logs if you want to look at it.

servercrash.txt

0 Likes 0 ·
servercrash.txt (6.1 KiB)
Citrus Yan avatar image Citrus Yan Yael Beaufort commented ·

Thanks for the info, your procedure looks alright to me. I think the issue that the Server-side cloud script is not executed should derive from the HttpManagerThread crash. Please navigate to this unreal thread to fix it first and see whether the aforesaid issue still occurs after the fix.

0 Likes 0 ·
Show more comments
Lewis Mohr avatar image Lewis Mohr Citrus Yan commented ·

For the logging issue, UE4 doesn't support changing the log location at runtime and it looked like the log folder path was only available from the GSDK.

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.