Sign In Register

How can we help you today?

Start a new topic

HTTP POST Request sometimes fails?

Hey there,


I already created a ticket on GameLift end, but I wanted to check here too, just to be sure.

My code to communicate with GameLift works in 3 of 4 Projects.
I compared the code and it's the same. I check the credentials of GameLift and they are fine.

My issue is, that if I create a call A and then a call B in the Response of call A, suddenly GameLift doesn't answer the call anymore.

I made sure that call B is not broken by calling it directly and that works.

I can't seem to figure out why this happens.

"message: Error performing POST for the URL https://gamelift.us-east-1.amazonaws.com/:gamelift.us-east-1.amazonaws.com:443 failed to respond\"


It's quite annoying ):


Any idea would be helpful.

Kind regards,
Cedric Neukirchen


1 person has this question

Ahhh I have this issue too!! I thought I was going crazy!


Error performing POST form for the URL https://partner.steam-api.com/ISteamMicroTxnSandbox/InitTxn/v3/:partner.steam-api.com:443 failed to respond


What's up with that ":" in there?


1 person likes this

I'm actually having the same issue here:


{"message":"Error performing POST for the URL https://partner.steam-api.com/ISteamMicroTxn/InitTxn/v3/:partner.steam-api.com:443 failed to respond"}


Did you guys found out the reason?

I ended up offsetting the requests via a short delay.

Hi Cedric, many thanks for the reply. Could you please elaborate (or give a small example) how did you do that? 

Well, I issued the first POST Request and in the response of that I used the Scheduler to delay the second Post request.

 

var Timer = Spark.getScheduler();
Timer.inSeconds("GL_RequestGameSessionState", 3, {"MatchID" : MatchID});

 It's been a while and I can't fully recall (nor am I allowed to share) all of the underlying code.
But that piece up there basically fixed it.

Oh I see, I didn't understand what you meant by offsetting the request. I understand now, it's a bit weird that we have to delay these kind of requests (especially on our case, when the requests that are failing are the ones to purchase an in-game product). Do they (gamesparks) give you a reason why we should do that this way or did you come up with the solution by yourself? Sorry for asking so many reasons, and again thank you so much for replying!

I never received an explanation. I used tried around until it was working.
Both of the requests worked on their own, so them not working together could only really be a reason of timing.
This also only happens if two requests are send directly after each other. If you encounter this with only one request, then it's a different issue.

Oh I see, well we are definitely encountering this with one request alone. I will wait a bit for a gs representative to join the conversation and eventually will create a ticket. Thanks again and happy coding!

 I've promoted this to Ticket #6215


We'll track it there better. Can you fill in your Game API and any other details please?


Cheers,

Omar

Yus, did. Should I post my latest answers into the ticket as well or is that somehow linked to this post?

 Hi Cedric, is call B in the Cloud Code of the response or on the client?


Cheers,

Omar

Hey Omar,


both calls are in Cloud Code. 

All of my Requests to GameLift use a "GL_Request" module, that does all the Signature stuff.

The calls themselves look like this:

 

/**
*   Requests the state of the specified GameSession.
*/

require('GL_Request');

function GL_GameSessionStateRequest(GameSessionID, CallbackFunction)
{
    var creds = { key: '##################', secret: '#################################'};
    var target = 'GameLift.DescribeGameSessionDetails';
    var requestBody = '{"GameSessionId":"' + GameSessionID + '"}';
    

    var Request = new AWSRequest(
        'gamelift.us-east-1.amazonaws.com',             // Endpoint
        '/',                                            // CanonicalURI
        {                                               // Query
        }
        ,
        [                                               // Headers
            {
                name : 'X-Amz-Target',
                value : target
            },
            {
                name: 'Content-Type',
                value: 'application/x-amz-json-1.1'
            }
        ],
        requestBody,                                    // Request Payload
        "us-east-1",                                    // Region
        "gamelift",                                     // Service
        creds                                           // Credentials
    );    

    Request.makeRequest(CallbackFunction);
}

 

In the Global "MatchFound" Message, I do this:

 

function OnCreateGameSessionResponse(result, error)
{
    if(result != null)
    {
        Spark.getLog().debug("Result Code: " + result.statusCode);
        Spark.getLog().debug("Result Headers: " + JSON.stringify(result.headers));
        Spark.getLog().debug("Result Data: " + JSON.stringify(result.data));
        
        // "200" means everything is good
        if(result.statusCode == 200)
        {
            var GameSessionID = result.data.GameSession.GameSessionId;
            GL_GameSessionStateRequest(GameSessionID, OnRequestGameSessionStateResponse);
        }
    }
    else if(error != null)
    {
        Spark.getLog().debug("Error Code: " + error.statusCode);
        Spark.getLog().debug("Error Headers: " + JSON.stringify(error.headers));
        Spark.getLog().debug("Error Data: " + JSON.stringify(error.data));
    }
}

GL_CreateGameSessionRequest(10, "alias-b9cb3135-7390-4fd4-af76-622ece965ebc", OnCreateGameSessionResponse);

 


The Response function for the second call looks similar, so I leave that away.

It all worked a few weeks ago in all other projects I used it in. Now it seems to fail with aboves Error.
I can call the "Call B" alone, without calling "Call A" before it, and it works.

So it only fails if I call them right after each other. It's also not about Call A or Call B. If I swap the order, Call A fails.

I assume it is on GameLift's end, but I just wanted to make sure that it's not a cause of recent changes to your HTTP Class or so.

Kind regards,
Cedric Neukirchen

 Hi Cedric,


Is there any information you can give us about the error? Maybe Gamelift can provide that? That way we can follow it up from our side.


Cheers,

Omar

I would love to. GameLift hasn't answered yes, but then again there was a weekend.

You can follow it here: https://gamedev.amazon.com/forums/questions/60652/gameliftus-east-1amazonawscom443-failed-to-respond.html

I will post here once I know more.

Kind regards,
Cedric Neukirchen

Login to post a comment