Aws::GameLift::Server::GetGameSessionId(); EMPTY

Hello,

I am trying to get the game session id from inside the game server hosting that session.

In this function the “GetGameSessionIdOutcome.GetResult()” is empty every time, what could be the issue or a fix?

Thanks


void AMyGameMode::updateGameSession(FString newState, FString pass)
{
#if WITH_GAMELIFT
	TSharedPtr<FJsonObject> RequestObj = MakeShareable(new FJsonObject);
	RequestObj->SetStringField("newState", newState);
	RequestObj->SetStringField("pass", pass);
	
	auto GetGameSessionIdOutcome = Aws::GameLift::Server::GetGameSessionId();

	if (GetGameSessionIdOutcome.IsSuccess()) {
		RequestObj->SetStringField("gameSessionId", GetGameSessionIdOutcome.GetResult());
			
		FString RequestBody;
		TSharedRef<TJsonWriter<>> Writer = TJsonWriterFactory<>::Create(&RequestBody);
		if (FJsonSerializer::Serialize(RequestObj.ToSharedRef(), Writer)) {
			TSharedRef<IHttpRequest> UpdateRequest= HttpModule->CreateRequest();
			
			UpdateRequest->SetURL(ApiUrl + "/updateGameSessionState");
			UpdateRequest->SetVerb("POST");
			UpdateRequest->SetHeader("Authorization", ServerPassword);
			UpdateRequest->SetHeader("Content-Type", "application/json");
			UpdateRequest->SetContentAsString(RequestBody);
			UpdateRequest->ProcessRequest();
		}
	}

#endif
}

I discovered that I get the id if there is max 1 concurrent server processes per instance, but whenever I turn it up to 2 or more, everyone gets “” (empty) Aws::GameLift::Server::GetGameSessionId().GetResult(), is this a gamelift bug? sure seems like it

Hi @patrick

Thanks for reaching out. I have cut a ticket for the gamelift team to look into this issue.

For now, you could potentially work around this issue by using multiple launch path/param instead of concurrent executions, for instance:

aws gamelift create-fleet --region $REGION \
--name "TestFleet" --ec2-instance-type c5.large  \
--ec2-inbound-permissions FromPort=6250,ToPort=6280,IpRange="0.0.0.0/0",\
Protocol=TCP FromPort=22,ToPort=22,IpRange="0.0.0.0/0",Protocol=TCP \
--build-id $BUILD_ID \
--runtime-configuration ServerProcesses="[{LaunchPath="/local/game/gamelift-test-app",Parameters='port:6251 gameSessionLengthSeconds:10',ConcurrentExecutions=1},\
{LaunchPath="/local/game/gamelift-test-app",Parameters='port:6252 gameSessionLengthSeconds:10',ConcurrentExecutions=1},\
{LaunchPath="/local/game/gamelift-test-app",Parameters='port:6253 gameSessionLengthSeconds:10',ConcurrentExecutions=1},\
{LaunchPath="/local/game/gamelift-test-app",Parameters='port:6254 gameSessionLengthSeconds:10',ConcurrentExecutions=1},\
{LaunchPath="/local/game/gamelift-test-app",Parameters='port:6255 gameSessionLengthSeconds:10',ConcurrentExecutions=1},\
{LaunchPath="/local/game/gamelift-test-app",Parameters='port:6256 gameSessionLengthSeconds:10',ConcurrentExecutions=1},\
{LaunchPath="/local/game/gamelift-test-app",Parameters='port:6257 gameSessionLengthSeconds:10',ConcurrentExecutions=1},\
{LaunchPath="/local/game/gamelift-test-app",Parameters='port:6258 gameSessionLengthSeconds:10',ConcurrentExecutions=1},\
{LaunchPath="/local/game/gamelift-test-app",Parameters='port:6259 gameSessionLengthSeconds:10',ConcurrentExecutions=1},\
{LaunchPath="/local/game/gamelift-test-app",Parameters='port:6260 gameSessionLengthSeconds:10',ConcurrentExecutions=1}]"

#GLIFT-15121