aws-samples / amazon-gamelift-unity

A multi-player game sample (server and client), developed with the Unity game engine, illustrating basic integration with Amazon GameLift. View the sample source code or build the project and experiment with game server deployment on the Amazon GameLift service.
Apache License 2.0
82 stars 22 forks source link

Error Deploying #13

Closed rsalas8 closed 3 years ago

rsalas8 commented 3 years ago

Hi,

First, thanks for the sample. Following step-by-step, I ran into an error. The game runs locally (rs,rc,rc,rc) however it craps out when deploying. I tried recreating the user several times. I still get the same error. Not sure what's going on. Looks like it's calling deploytool.exe. Not sure why it's not happy. Thanks!

C:\Users\rosssalas\src\github\amazon-gamelift-unity\Build>deploy.bat 25.0 PLEASE WAIT. DEPLOYMENT PROCESS TAKES A FEW MINUTES. Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object. at Amazon.Runtime.DefaultInstanceProfileAWSCredentials.FetchCredentials() at Amazon.Runtime.DefaultInstanceProfileAWSCredentials.GetCredentials() at Amazon.Runtime.Internal.CredentialsRetriever.PreInvoke(IExecutionContext executionContext) at Amazon.Runtime.Internal.CredentialsRetriever.InvokeSync(IExecutionContext executionContext) at Amazon.Runtime.Internal.PipelineHandler.InvokeSync(IExecutionContext executionContext) at Amazon.Runtime.Internal.RetryHandler.InvokeSync(IExecutionContext executionContext) at Amazon.Runtime.Internal.PipelineHandler.InvokeSync(IExecutionContext executionContext) at Amazon.Runtime.Internal.CallbackHandler.InvokeSync(IExecutionContext executionContext) at Amazon.Runtime.Internal.PipelineHandler.InvokeSync(IExecutionContext executionContext) at Amazon.Runtime.Internal.EndpointResolver.InvokeSync(IExecutionContext executionContext) at Amazon.Runtime.Internal.PipelineHandler.InvokeSync(IExecutionContext executionContext) at Amazon.Runtime.Internal.Marshaller.InvokeSync(IExecutionContext executionContext) at Amazon.Runtime.Internal.PipelineHandler.InvokeSync(IExecutionContext executionContext) at Amazon.Runtime.Internal.CallbackHandler.InvokeSync(IExecutionContext executionContext) at Amazon.Runtime.Internal.PipelineHandler.InvokeSync(IExecutionContext executionContext) at Amazon.Runtime.Internal.ErrorCallbackHandler.InvokeSync(IExecutionContext executionContext) at Amazon.Runtime.Internal.PipelineHandler.InvokeSync(IExecutionContext executionContext) at Amazon.Runtime.Internal.MetricsHandler.InvokeSync(IExecutionContext executionContext) at Amazon.Runtime.Internal.RuntimePipeline.InvokeSync(IExecutionContext executionContext) at Amazon.Runtime.AmazonServiceClient.Invoke[TRequest,TResponse](TRequest request, IMarshaller`2 marshaller, ResponseUnmarshaller unmarshaller) at Amazon.IdentityManagement.AmazonIdentityManagementServiceClient.GetUser(GetUserRequest request) at Amazon.IdentityManagement.AmazonIdentityManagementServiceClient.GetUser() at DeployTool.Program.GetAWSNum() at DeployTool.Program.d4.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at DeployTool.Program.d3.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at DeployTool.Program.Main(String[] args) C:\Users\rosssalas\src\github\amazon-gamelift-unity\Build>dir Volume in drive C is Local Volume Serial Number is 4A0A-D470 Directory of C:\Users\rosssalas\src\github\amazon-gamelift-unity\Build 10/14/2020 08:25 PM

. 10/14/2020 08:25 PM .. 10/14/2020 08:25 PM 1,171 build.bat 10/14/2020 08:25 PM 4,561 buildconfig.bat 10/14/2020 08:25 PM 3,108 builddeploytool.bat 10/14/2020 08:25 PM 12,824 buildsdk.bat 10/14/2020 08:25 PM 2,833 clean.bat 10/14/2020 08:25 PM 2,350 delconfig.bat 10/14/2020 08:25 PM 1,683 deploy.bat 10/14/2020 08:25 PM 2,071 distro.bat 10/14/2020 08:25 PM FixSdk 10/14/2020 08:25 PM 2,062 loadconfig.bat 10/14/2020 08:25 PM 1,277 profile.bat 10/14/2020 08:25 PM 1,569 rc.bat 10/14/2020 08:25 PM 845 rs.bat 10/14/2020 08:25 PM 3,239 saveconfig.bat 13 File(s) 39,593 bytes 3 Dir(s) 121,293,103,104 bytes free

alanmur commented 3 years ago

Hello, probably credentials missing from your shared credentials file. Does the following command work for you?

2020-10-20_17-56-53

If not, please try to create a set of local user credentials. Instructions here

Al Murray :)

rsalas8 commented 3 years ago

Here is the output of 'aws iam get-user': Capture

rsalas8 commented 3 years ago

The docs state that the credentials are stored in ~/.aws directory. My credentials are being stored somewhere but I couldn't find where. There is no ~/.aws directory on my system (Windows 10).

C:\src\github.com\amazon-gamelift-unity-master\Build>aws configure AWS Access Key ID [****2CKE]: AWS Secret Access Key [****8gVq]: Default region name [us-east-1]: Default output format [json]:

C:\src\github.com\amazon-gamelift-unity-master\Build>ls \users\rosssalas '3D Objects' NetHood AppData OneDrive 'Application Data' Pictures 'Cisco Packet Tracer 7.2' PrintHood 'Cisco Packet Tracer 7.3.1' PycharmProjects

alanmur commented 3 years ago

Hello rsalas8!

On Windows, the credentials file is in your user folder (yours is called C:\Users\rosssalas\), in the .aws subdir, see this example of mine (secret key is private to you, do not share this with me)

2020-10-22_20-01-17

As you see, there is a [default] profile in my file. This is the one that is used by the deploy tool to call AmazonIdentityManagementServiceClient.GetUser(). I'm guessing, but maybe you have set up different permissions using named profiles, or you are missing a default profile, or you have set the AWS_PROFILE environment variable to a profile that does not exist.

To reproduce this, I rename my [default] profile and call it [nothing], the file looks like this

2020-10-22_20-40-32

Calling deploy results in the same error as you see.

2020-10-22_20-44-46

But then I can set the AWS_PROFILE environment variable to the profile name with the permissions and it works.

2020-10-22_20-59-49

You can force the profile to a named profile in the command line test before.

2020-10-22_20-26-11

Let me know if this helps,

Al Murray :)

alanmur commented 3 years ago

Oh, one other detail! the .aws directory is a hidden directory. You will only see it in File Explorer if you check to view hidden items.

2020-10-22_21-15-03

rsalas8 commented 3 years ago

Thanks for following up. This literally had me racking my brain. This whole time I have been using Windows 10 Command Prompt to build this project. For some reason, the 'aws configure' command was storing my credentials to git bash home (~) directory (subdir .aws). However, the deploy (deploytool) wasn't aware of that environment. That's why I continued receiving authentication errors when deploying. After uninstalling git bash, it worked like a charm. Thanks again!

alanmur commented 3 years ago

Thank you, glad it's all working now.