Jnug
August 30, 2019, 1:32pm
1
I’m using the AWS .NET SDK for Unity for uploading images into our S3 bucket. Using GetObjectAsync
method seems to work fine and I can see the image loaded properly. However, using PostObjectAsync
or PutObjectAsync
does not seem to work when building for iOS. It does work when using the Editor or building for Android. I’ve seen a similar issue a year before and still exists up to now. Below are some of those I found:
opened 10:33PM - 07 Mar 18 UTC
closed 12:24AM - 17 Jul 20 UTC
Unity
closed-for-staleness
Are you guys tracking issues with UnityWebRequest in Unity 2017.3.x and 2018.x o… n iPhone? We've had several issues that have forced us to stay with Unity 2017.2.2f1 (where the issues don't seem to occur). The issues only occur on iPhone (using IL2CPP). We don't see them on Android (not using IL2CPP) nor in the Unity Editor on Windows and Mac.
## Issue 1:
When trying to download files from a public bucket on S3 via GetObjectAsync, we occasionally crash with EXC_BAD_ACCESS (code=1, address=0xffffffff00000000). Here's the call stack:
```
0x00000001025413b4 in ::Job_ExecuteUnityWebRequest() at /Users/builduser/buildslave/unity/build/Modules/UnityWebRequest/Public/Prototypes/UnityWebRequestProto.h:207
0x000000010207c854 in ExecuteJobFunc [inlined] at /Users/builduser/buildslave/unity/build/Runtime/Jobs/Internal/JobQueue.cpp:386
0x000000010207c840 in ::Exec() at /Users/builduser/buildslave/unity/build/Runtime/Jobs/Internal/JobQueue.cpp:440
0x000000010207c7c0 in ::Steal() at /Users/builduser/buildslave/unity/build/Runtime/Jobs/Internal/JobQueue.cpp:573
0x000000010207cb98 in ::ExecuteJobFromQueue() at /Users/builduser/buildslave/unity/build/Runtime/Jobs/Internal/JobQueue.cpp:770
0x000000010207cc78 in ::ProcessJobs() at /Users/builduser/buildslave/unity/build/Runtime/Jobs/Internal/JobQueue.cpp:823
0x000000010207c298 in ::WorkLoop() at /Users/builduser/buildslave/unity/build/Runtime/Jobs/Internal/JobQueue.cpp:893
0x0000000102152d50 in ::RunThreadWrapper() at /Users/builduser/buildslave/unity/build/Runtime/Threads/Thread.cpp:36
0x000000019028575c in _pthread_body ()
0x000000019028566c in _pthread_start ()
0x0000000190282d84 in thread_start ()
```
## Issue 2
The second issue is with PutObjectAsync. When trying to upload files to a secure bucket we get a SignatureDoesNotMatch AmazonServiceException. We saw that some people worked around this by disabling chunkedTransfer on the AWSSDK's UnityWebRequests and it worked for us too.
```
AmazonServiceException:
ErrorCode=SignatureDoesNotMatch
ErrorType=Sender
Message=The request signature we calculated does not match the signature you provided. Check your key and signing method.
StatusCode=Forbidden
```
## Expected Behavior
GetObjectAsync shouldn't crash and PutObjectAsync shouldn't require the chunkedTransfer workaround.
## Current Behavior
As described above for both issues.
## Possible Solution
Issue 1: Remain with Unity 2017.2.2f1.
Issue 2: Disable chunkedTransfer or remain with Unity 2017.2.2f1.
## Steps to Reproduce (for bugs)
Let me know if you need more info and I'll work to collect it for you. (logs, dumps or whatever)
## Context
So far, these issues are preventing us from using the AWS SDK for S3 on the latest versions of Unity.
## Your Environment
* AWSSDK.Core version used: 3.3.21.15 from SDK version 3.3.245.2
* Service assembly and version used: S3.dll version 3.3.17.1 from SDK version 3.3.245.2
* Operating System and version: iPhone iOS 11
* Visual Studio version: 2017 version 15.6.0
* Targeted .NET platform: v3.5 (Unity)
opened 03:20PM - 15 Jan 18 UTC
closed 12:33AM - 13 Mar 21 UTC
bug
Unity
response-requested
module/unity
closed-for-staleness
Folks this just feels like the SDK is broken and after reading issues like below… it makes me want to move to another provider.
https://github.com/aws/aws-sdk-net/issues/332
For me the problem is pretty clearly that in the web request it is trying to set headers that it shouldn't be touching:
InvalidOperationException: Cannot override system-specified headers
Looks like the culprit is Content-Length.
This happening when I try to put anything into my bucket (I can get from it just fine). I get different errors when I try to post but they where so generically non-sensical I switched to put.
The other change I have from the demo example is that I use:
` awsCredentials = new BasicAWSCredentials(AWSAccessKey, AWSSecretKey);`
I’ve tried their workaround but still to no avail. Have tried this but still no luck. Don’t know if only the UnityWebRequestWrapper.cs
file should be changed.
Error message:
The request signature we calculated does not match the signature you provided. Check your key and signing method.
Have any of you out there experienced a similar case? Can you provide information or a solution to fix this?
Unity version: 2019.1.8f1
AWS .NET SDK version: Latest as of writing.
A big thank you in advance!
Jnug
September 10, 2019, 3:29am
2
Fixed it by upgrading to Unity version 2019.2.3f1 .
Unfortunately this didnt fix it for me. What fixed it for me is by adding the header reserved properties bypass fix for UnityWWWRequestFactory.cs