Problems sending HTTP requests to GameLift

Hi there,

I’m making a game in Unreal that uses GameLift for hosting and Gamesparks for matchmaking and other online services. I’ve been following this guide

https://forums.awsgametech.com/t/best-way-to-start-ue4-dedicated-servers-on-demand/2729/1

which has helped me massively. The aim is to be able to communicate with GameLift directly from Gamesparks.

At the moment, it feels like it’s close to working - I had various issues with the header signature being wrong but i’m not getting any errors about this now. I’m trying to make the same ListAliases request as in the guide.
My request looks like this:

requestPayload: "{\"__type\":\"ListAliasesInput\"}"
postURL: "https://gamelift.eu-west-1.amazonaws.com/" Header: "Authorization: AWS4-HMAC-SHA256 Credential=-removed-/20170705/eu-west-1/gamelift/aws4_request, SignedHeaders=content-type;host;x-amz-date;x-amz-target, Signature=-removed-" Header: "host: gamelift.eu-west-1.amazonaws.com/" Header: "x-amz-date: 20170705T154505Z" Header: "content-type: application/x-amz-json-1.1" Header: "x-amz-target: GameLift.ListAliases"

and the response I’m getting is this:

{"statusCode":400,"headers":{"Server":"Server","Connection":"close","Content-Length":"167","Date":"Wed, 05 Jul 2017 15:45:05 GMT","Content-Type":"text/html"},"data":null}

Have you got any ideas what I might be doing wrong here? Any help would be massively appreciated.

Thanks,
Patrick

Sorry for the issues you are encountering. I’ve filed a ticket with the tech team to get you some answers.

Brilliant - thanks for your help

I’ve bumped this internally with the tech team. Sorry for the delay.

Hi @Binky_LY. I’m just wondering if anyone has had a chance to look at this, or when you expect they might be able to? Thanks

Hi @Binky_LMBR. I still haven’t heard anything regarding this. Do you need more information or is there anything else I can do to help identify the issue?

So sorry for the delay. I have updated the ticket once more and hope to get you some answers very soon.

Any news on this @Binky_LMBR? I’m now doubting if it’s sensible hosting my game on GameLift when it seems like it’s impossible to get my support questions answered! I’m going to give this ticket one more day before I move over to an alternative service

Hi Patrick,

There are a couple of things that I noticed from your headers that are different from what I am sending in my C# sample of doing the same call.
Most notable clues are fro the Authorization header. Mine looks like:

AWS4-HMAC-SHA256 Credential=AKIAIPYL2NP4MQLU2VRQ/20170721/us-east-1/gamelift/aws4_request, SignedHeaders=content-length;content-type;host;x-amz-content-sha256;x-amz-date;x-amz-target, Signature=0cc147a58008d5687a36ef659747775786257e1db2447f739ae173e4c0c57530

In this it tells me what headers that I am sending. I have two that you do not. One is

"content-length:2"

This is set to the same length as the string requestPayload. Since I am sending “{}” as my payload, it is shorter than yours. Whatever the length of your payload is, send that as the content length.
The other header that you are missing is:

"x-amz-content-sha256:44136fa355b3678a1146ad16f7e8649e94fb4fc21fe77e8310c060f61caaff8a"

This is the SHA256 hash of the content. The content in this case is the string requestPayload again. The javascript files to create the hash is provided as an attachment to my post in the other thread that you reference.

My final point that I would like to make is that the exact payload needed was different for eXi than what I needed. Try both and see what works.

Thank you!

Al Murray :)
Solutions Architect
Amazon Game Services

Thanks for the reply! I’m gonna give this a go now and see if it fixes it

@Patrick Most notable clues are fro the Authorization header. Code by @AlMurray correct (right) I hope I have helped!
right. Thank you.