BAD_REQUEST_EXCEPTION when calling StartMatchBackfill on GameLift C++ SDK (Unreal Plugin)


Hey, I'm trying to implement the manual backfill into my server. I'm using Unreal Engine 5.3 and the GameLift plugin for Unreal. Unfortunately when I call StartMatchBackfill I get a BAD_REQUEST_EXCEPTION error. I've tried checking if all the parameters were passed correctly with the VS debugger and they were (I've passed the m_matchmakingConfigurationArn, m_gameSessionArn and m_players; I have two players and m_players is passing m_playerId, m_team, m_playerAttributes and m_latencyInMs correctly. The only parameter missing is the ticket id which should be auto-generated by AWS. I've even tried adding it manually, but I'm getting the same error. I've also tried to start the match backfill on the AWS CLI using the parameters logged out by my game server and there it's working properly. So I don't know what to do now since I don't have more detailed informations about this BAD_REQUEST_EXCEPTION. Thanks for your help!

EDIT: This is a screenshot of the outcome in the VS Debugger: Screenshot

  • Hey Scienziatogm, is there an error message that goes along with your BAD_REQUEST_EXCEPTION that you could provide here?

  • Hey Jackson, the error message in the outcome of StartMatchBackfill ( auto outcome = Aws::GameLift::Server::StartMatchBackfill(sdkRequest); ) is "Bad request exception" and nothing else. The error message doesn't have details at all and that's why I don't know what's wrong with the request. I'm using the VS debugger and reading the values in the variable outcome directly. m_errorType is BAD_REQUEST_EXCEPTION(21), m_errorName is "Bad request exception" and m_errorMessage is "Bad request exception".

  • Well that doesn't seem helpful! I've cut an item to our engineers to improve the logging there.

asked 15 days ago110 views
1 Answer
Accepted Answer

Hey Scienziatogm, this doesn't solve your problem, but it might help your debugging since the logs aren't helpful at the moment. I've looked at the source code for the 5.1 C++ Server SDK and it looks like the exception message is hard-coded to bad request at the path: gamelift-server-sdk/source/aws/gamelift/internal/GameLiftServerState.cpp > Internal::GameLiftServerState::StartMatchBackfill:

Internal::GameLiftServerState::StartMatchBackfill(const Aws::GameLift::Server::Model::StartMatchBackfillRequest &startMatchBackfillRequest) {
    if (AssertNetworkInitialized()) {
        return StartMatchBackfillOutcome(GameLiftError(GAMELIFT_ERROR_TYPE::GAMELIFT_SERVER_NOT_INITIALIZED));

    WebSocketStartMatchBackfillRequest request = Internal::StartMatchBackfillAdapter::convert(startMatchBackfillRequest);
    GenericOutcome rawResponse = m_webSocketClientManager->SendSocketMessage(request);
    if (rawResponse.IsSuccess()) {
        WebSocketStartMatchBackfillResponse *webSocketResponse = static_cast<WebSocketStartMatchBackfillResponse *>(rawResponse.GetResult());
        StartMatchBackfillResult result = Internal::StartMatchBackfillAdapter::convert(webSocketResponse);
        delete webSocketResponse;

        return StartMatchBackfillOutcome(result);
    } else {
-->     return StartMatchBackfillOutcome(GameLiftError(GAMELIFT_ERROR_TYPE::BAD_REQUEST_EXCEPTION));

rawResponse is a GenericOutcome which might have a GameLiftError of it's own. You could try updating that line to something like the following and see if you get a more useful error back:

    } else {
        return StartMatchBackfillOutcome(rawResponse.GetError());
answered 11 days ago
  • Hey Jackson, I've fixed the issue thanks to your help. I've totally forgot that the source code of the SDK was provided and I could modify that, rebuilding the libraries using CMake. The issue was that I had inverted the GameSessionArn with MatchmakingConfigArn, so it was my mistake, sorry about that. Anyway this answer could be very helpful if someone doesn't get the detailed error result and has a similar issue that's hard to find even when debugging. Thank you again for the help!

  • That's great to hear! I'm glad I could help

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions