aws-sdk-net: Unity : S3Example GetObjects not working. User-Agent header issue
I downloaded latest unity SDK “aws-sdk-unity_3.3.83.0.zip” and installed S3 unitypackage. but in GetObjects function I am getting error. Following is trace of the problem
ArgumentException: Cannot set Request Header User-Agent - name contains illegal characters or is not user-overridable
UnityEngine.Networking.UnityWebRequest.SetRequestHeader (System.String name, System.String value) (at /Users/builduser/buildslave/unity/build/artifacts/generated/common/modules/UnityWebRequest/WebRequestBindings.gen.cs:473)
UnityEngine.WWW..ctor (System.String url, System.Byte[] postData, System.Collections.Generic.Dictionary`2 headers) (at /Users/builduser/buildslave/unity/build/Runtime/WebRequestWWW/UWRWWW.cs:60)
Amazon.Runtime.Internal.UnityMainThreadDispatcher+<InvokeRequest>d__7.MoveNext ()
UnityEngine.SetupCoroutine.InvokeMoveNext (IEnumerator enumerator, IntPtr returnValueAddress) (at /Users/builduser/buildslave/unity/build/Runtime/Export/Coroutines.cs:17)
UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator)
Amazon.Runtime.Internal.UnityMainThreadDispatcher:ProcessRequests()
Amazon.Runtime.Internal.UnityMainThreadDispatcher:Update()
Expected Behavior It used to work seamlessly in Unity version 5.6
Steps to Reproduce Simply running example scene can reproduce issue
Your Environment I am currently using Unity 2017.1.0b2 and building for MAC platform. .NET version in Unity build settings: 3.5
About this issue
- Original URL
- State: closed
- Created 10 years ago
- Comments: 31 (2 by maintainers)
I did a little more investigation. It looks like AWSSDK doesn’t properly detect that it should be using
UnityWebRequestin Unity 2017.1.0bX.If I manually set the client it seems to be working fine.
Amazon.AWSConfigs.HttpClient = Amazon.AWSConfigs.HttpClientOption.UnityWebRequest;I’m experiencing a similar issue with Cognito Identity and Unity 2017.1.0b4 on MacOS.
Unity made some additional changes to
UnityWebRequestin 2017.1.0b3/b4.I’ve tried with both MobileAnalytics and the S3 sample (in a new empty project). After adding Ids/regions to the sample script and starting the project I get the following error:
Looks like the. My wrong, error is in the actual S3 request, so same place as was reported earlier._credentials = new CognitoAWSCredentials(IdentityPoolId, _CognitoIdentityRegion);is where it breaks.UnityPackage:
AWSSDK.S3.3.3.6.0.unitypackageI downloaded the Unity SDK from here http://sdk-for-net.amazonwebservices.com/latest/aws-sdk-unity.zip
Here is function I am using from S3Example.cs
Error is in following line
You can see exception stack trace in question above Thanks for taking time!