Skip to content

FAQs for GameLift, AWS, and Unity

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

Back to Dev Log

  • 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!