Skip to content

FAQs for GameLift, AWS, and Unity

A collection of GameLift, AWS, and Unity FAQs and troubleshooting

Back to Dev Log

  • Unauthorized or Forbidden in error messages

    • This is likely due to missing or incorrect permissions. Check all the roles and policies you have attached to your identity pool, lambda function, etc.
    • Make sure the policies have the correct permission to access the resources. If you have a policy for GameLift attached to an identity pool, without any permissions for GameLift, well you probably need to add those permissions. This goes for any resources you’re trying to access.
    • If you are using a User Pool, make sure your Identity Pool has the Cognito tab under Authentication providers completed with user pool id and app client id.
    • If you’re allowing users access who are unauthenticated, make sure you check the “Enable access to unatuenticatded identities” in the Identity pool.
  • Check the region!!!

    • The most common error I see is an incorrect region somewhere in the code
    • Make sure you do a search in the baseline for us-east-1, if you are NOT using us-east-1 for GameLift or whatever else you’re working on, make sure to change it to the region you’ve deployed your services to.
  • Ports in Gamelift fleet

    • Do you have the correct port range and protocol? Make sure you select TCP or UDP based on whatever your network solution is using.
  • Things specific to BatterAcidDev code

    • I use an “isProd” flag in some of my projects, when added it readies the code to be deployed to actual AWS services and NOT local testing.
    • Make sure you have this flag added where applicable, noted in the videos.
  • Fleet Instances

    • Make sure you have at least 1 fleet instance under the “Active Instances” header on the fleet details
    • You can scale the instances up or down under the Scaling tab, towards the bottom.
    • Make sure to set it back to 0 when not testing, or else you will be billed!
  • Code configurations

    • Make sure your code has the correct fleet id
    • The correct region you’re working in
    • The correct identity pool id
  • Check your logs!

    • Make sure you are reviewing all the logs.
    • GameLift session logs are available once a game session is terminated. If your game session is stuck open, tick down the desired instance count to 0 and wait for it to shutdown, then the logs will be available.
    • If you are debugging an issue, make sure you place debug logs throughout your code to help you track down the issue.
    • If you see logs in Unity and they seem like a wall of useless text, well, look closely, there's usually one line in there that will give us a hint at what the issue is. See the HttpErrorResponseException example below, it illustrates how one line can make the difference!
  • HttpErrorResponseException: Thrown from an AWS Lambda call

    This is a general exception that I see quite a bit as it can be thrown from various AWS API calls. But for this one, I'll be focusing an example exception that's thrown when calling out to a Lambda function from your Unity project. As in the case when you're trying to connect to the Realtime GameLift server. It may look something like this:

       HttpErrorResponseException: Exception of type 'Amazon.Runtime.Internal.HttpErrorResponseException' was thrown.
       Amazon.Runtime.HttpWebRequestMessage+d__20.MoveNext () 
       --- End of stack trace from previous location where exception was thrown ---
       System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw ()
       System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task)
       System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task)
       System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task)
       System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1+ConfiguredTaskAwaiter[TResult].GetResult ()
       Amazon.Runtime.Internal.HttpHandler`1+d__9`1[TRequestContent,T].MoveNext () 
       --- End of stack trace from previous location where exception was thrown ---

    When you click on the error you'll see a much larger stack trace that just seems to repeat. However, if you look carefully, you'll see the real cause: the call you made from your Unity project to the Lambda function was denied. AmazonLambdaException


    • Usually that means there's something wrong with the permissions set in the role:
      • Make sure you have the correct Actions and Resource.
      • Make sure the Lambda function name is the one you're trying to access.
      • Double check the region.
    • If the role looks good, make sure that it's attached to the correct identity Pool.
    • Check your Cognito Identity Pool configurations (select the pool, hit edit in top right) and verify the Unauthenticated role is set to the correct one.
    • If you find something else that worked, please let me know and I'll add it!