aws-sdk-net: Unity SDK - S3 PostObject Amazon.Runtime.Internal.HttpErrorResponseException when using S3CannedACL.PublicRead
AWS SDK version: aws-sdk-unity_3.1.57.0 Platform: Unity v5.3.4f1 (Mac OS Unity Editor and iOS 8.0 onwards)
When posting a file to a S3 bucket using the S3CannedACL.PublicRead, an Amazon.Runtime.Internal.HttpErrorResponseException is returned. Using the same code but with S3CannedACL.Private, the file is successfully uploaded.
The request is formed as follows:
var request = new PostObjectRequest()
{
Bucket = S3BucketName,
Key = fileName,
InputStream = stream,
CannedACL = S3CannedACL.PublicRead
};
Is S3CannedACL.PublicRead not a valid option? Or does the bucket need to be configured differently?
About this issue
- Original URL
- State: closed
- Created 11 years ago
- Comments: 43 (3 by maintainers)
Hi Guys, I would suggest to change your post request to this ->
In my case the default region used by the request was not the one that I need đ
Iâm also using S3Example.cs from Unity AWSSDK and got HttpErrorResponseException, then after i setting AWSConfigs in Start()
now i can see the problem
try with Full Access Policy and itâs works
To fix the issue with the AWSConfig.XML, just add correctForClockSkew=âtrueâ in the aws tag cf. https://github.com/aws/aws-sdk-unity/blob/master/Assets/AWSSDK/src/Core/Resources/awsconfig.xml
However, I also have the Amazon.Runtime.Internal.HttpErrorResponseException when trying to upload a file (whatever CannedACL I use), but cannot get any log to help me understand where it could come from. (The only difference with the sample is using BasicAWSCredentials instead of CognitoAWSCredentials)
Any pointer would be appreciated.
I ran into the same issue using Unity 2017.3.
It seems they have defaulted the chunkedTransfer to true which is causing me the error
Iâve fixed up the SDK AWS.Core you can grab it here⌠just replace this with the one inside Unity and you should be good to go.
https://drive.google.com/open?id=1TC_aTv3d6DWc6gtPdEND79jOhbEZ0v3A
Any word on this yet? The one-year anniversary is approaching. There are now three other Unity S3 upload bugs posted, and they all are difficult or impossible for us to debug because of the poor error handling here. Can we get some support for S3 uploads in Unity via .Net, or is it time to move to Azure? Sorry for the saltiness, but Iâve lost a LOT of time on this, chasing wild geese everywhere (âtry private instead of publicreadâ, âspecify the region 'cuz it doesnât default correctlyâ, âset AWSConfig in code before creating clientâ) ⌠ugh. The lack of error reporting makes this whole process an even worse nightmare.
I managed to upload the file using PutObjectRequest intead of post.
` Debug.Log(âCreating request objectâ); var request = new PutObjectRequest() { BucketName = S3BucketName, Key = Path.GetFileName(path), InputStream = stream, CannedACL = S3CannedACL.Private };
Hi Max,
I did finally get things to work, but unfortunately canât recall what specific steps I took to get that way. My code is very similar to yours, with the exception that I do not set the Region and ContentType in my request (my region is the same as that in my client, so it didnât matter despite what others have said, it appears). Also, and perhaps more applicable to your specific issue, Iâm using a try/catch block around my PostObjectAsync call so that I can get more information from unhandled exceptions when things fail. Youâll note the slight difference in the error string printed from the two error cases. Hope it helps! My code is below.