<p>Per the original poster's 2nd edit, the issue had to do with their company firewall blocking the request to S3.</p>

<blockquote>
  <p>After more troubleshooting and testing this on a remote server it looks like the issue has to do with our company firewall not allowing receipt of the response object from the S3 request. We had no issues uploading assets to S3 from the same codebase on a remote server and are now looking into a work-around with the firewall.</p>
</blockquote>

CC BY-SA 3.0
2016-11-24T08:25:39.103Z
Looks like this is a problem that occurs every now and then, and we just ran into it now. So would it be possible to have a troubleshooting section for this in the Craft documentation?
peirix
CC BY-SA 3.0
2016-04-25T16:59:05.650Z
2016-04-25T16:59:05.650Z
Brad Bell
<p>I am having an issue with uploading assets to S3 from Craft.  So far I have taken the following steps:</p>

<ol>
<li>Create permission policy and attached to group containing craft
user:

<blockquote>
<pre><code>{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "s3:ListAllMyBuckets"
            ],
            "Resource": "arn:aws:s3:::"
        },
        {
            "Effect": "Allow",
            "Action": [
                "s3:GetBucketLocation",
                "s3:ListBucket",
                "s3:PutObject",
                "s3:GetObject",
                "s3:DeleteObject",
                "s3:GetObjectAcl",
                "s3:PutObjectAcl"
            ],
            "Resource": [
                "arn:aws:s3:::&lt;bucket_name&gt;/*"
            ]
        },
        {
            "Effect": "Allow",
            "Action": [
                "s3:GetBucketLocation",
                "s3:ListBucket"
            ],
            "Resource": [
                "arn:aws:s3:::&lt;bucket_name&gt;"
            ]
        }
    ] }
</code></pre>
</blockquote></li>
<li>Create new asset source with type of Amazon S3 and input access and
secret key for craft user.  This allows me to select the available
bucket.</li>
<li>Save the asset source and go to the asset section to upload a file
to S3.  At this point the status bar fills up and the upload hangs
indefinitely.</li>
</ol>

<p>Other notes:</p>

<ul>
<li>These are very small images (&lt;100KB)</li>
<li>I am able to bring images into Craft if I upload them directly to S3
and then update asset indexes in the setting.</li>
<li>I also noticed that the error logs print out the message:   

<blockquote>
  <p>exception 'S3Exception' with message
  'S3::getObjectInfo([bucket_name], [file_name]): [52] Empty
  reply from server' in
  /Users/[user]/Sites/[project]/craft/app/lib/S3.php:777</p>
</blockquote></li>
<li>I have also tried using the more broad 'AmazonS3FullAccess' policy
with the same results.</li>
</ul>

<p>EDIT:
In continuing to explorer this issue I have found that a call is being made from the S3AssetSourceType file in the insertFileInFolder function to the S3 class getObjectInfo function.  It seems like this error is occurring because the code is trying to fetch information from amazon on an object that does not yet exist because this call occurs prior to the put object call.  I have yet to understand why the getObjectInfo is called within the insertFileInFolder call before a put object request is made to S3.</p>

<p>EDIT 2:
After more troubleshooting and testing this on a remote server it looks like the issue has to do with our company firewall not allowing receipt of the response object from the S3 request.  We had no issues uploading assets to S3 from the same codebase on a remote server and are now looking into a work-around with the firewall.</p>

CC BY-SA 3.0
2016-02-24T23:23:07.487Z
Do local assets work OK?
RitterKnight
CC BY-SA 3.0
2016-02-25T14:07:02.140Z
Yes.  I initially started with a local folder and all the images uploaded fine through craft.  I then updated that local assets source to use S3 and saw this error.  After that I deleted the original assets source and created a new S3 source from scratch with a new S3 user and still received the same error.
tplassman
CC BY-SA 3.0
2016-03-04T14:42:35.753Z
It's fetching the file info to make sure that such a file does not exist already. Is your server time set correctly?
Andris Sevcenko
CC BY-SA 3.0
2016-03-04T15:35:04.767Z
That makes sense.  Thanks for the clarification.  I checked the timezone and indeed, the timezone in Craft was set to UTC while the php timezone was set to America/New_York.  I updated the timezone in Craft but still get the same error when trying to upload.  Is there anything else I should do after changing the timezone and before trying to upload assets?
tplassman
CC BY-SA 3.0
2016-11-24T08:24:30.273Z
Did you find a way around this? Having the same problem now.
peirix
<assets><error><upload><s3>
S3 Asset uploading hangs
# S3 Asset uploading hangs

(Asked by: username_0 on 2016-02-24)

I am having an issue with uploading assets to S3 from Craft.  So far I have taken the following steps:

Create permission policy and attached to group containing craft
user:


{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "s3:ListAllMyBuckets"
            ],
            "Resource": "arn:aws:s3:::"
        },
        {
            "Effect": "Allow",
            "Action": [
                "s3:GetBucketLocation",
                "s3:ListBucket",
                "s3:PutObject",
                "s3:GetObject",
                "s3:DeleteObject",
                "s3:GetObjectAcl",
                "s3:PutObjectAcl"
            ],
            "Resource": [
                "arn:aws:s3:::/*"
            ]
        },
        {
            "Effect": "Allow",
            "Action": [
                "s3:GetBucketLocation",
                "s3:ListBucket"
            ],
            "Resource": [
                "arn:aws:s3:::"
            ]
        }
    ] }


Create new asset source with type of Amazon S3 and input access and
secret key for craft user.  This allows me to select the available
bucket.
Save the asset source and go to the asset section to upload a file
to S3.  At this point the status bar fills up and the upload hangs
indefinitely.

Other notes:

These are very small images (<100KB)
I am able to bring images into Craft if I upload them directly to S3
and then update asset indexes in the setting.
I also noticed that the error logs print out the message:   


exception 'S3Exception' with message
  'S3::getObjectInfo([bucket_name], [file_name]): [52] Empty
  reply from server' in
  /Users/[user]/Sites/[project]/craft/app/lib/S3.php:777

I have also tried using the more broad 'AmazonS3FullAccess' policy
with the same results.

EDIT:
In continuing to explorer this issue I have found that a call is being made from the S3AssetSourceType file in the insertFileInFolder function to the S3 class getObjectInfo function.  It seems like this error is occurring because the code is trying to fetch information from amazon on an object that does not yet exist because this call occurs prior to the put object call.  I have yet to understand why the getObjectInfo is called within the insertFileInFolder call before a put object request is made to S3.
EDIT 2:
After more troubleshooting and testing this on a remote server it looks like the issue has to do with our company firewall not allowing receipt of the response object from the S3 request.  We had no issues uploading assets to S3 from the same codebase on a remote server and are now looking into a work-around with the firewall.

**Tags:** assets, error, upload, s3

> **Comments:**
> **username_1**: Do local assets work OK?  
> **username_0**: Yes.  I initially started with a local folder and all the images uploaded fine through craft.  I then updated that local assets source to use S3 and saw this error.  After that I deleted the original assets source and created a new S3 source from scratch with a new S3 user and still received the same error.  
> **username_2**: It's fetching the file info to make sure that such a file does not exist already. Is your server time set correctly?  
> **username_0**: That makes sense.  Thanks for the clarification.  I checked the timezone and indeed, the timezone in Craft was set to UTC while the php timezone was set to America/New_York.  I updated the timezone in Craft but still get the same error when trying to upload.  Is there anything else I should do after changing the timezone and before trying to upload assets?  
> **username_3**: Did you find a way around this? Having the same problem now.  

---

## 1 answers

### Answer by username_4 on 2016-04-25. Score: 1 | Accepted answer

Per the original poster's 2nd edit, the issue had to do with their company firewall blocking the request to S3.

> After more troubleshooting and testing this on a remote server it looks like the issue has to do with our company firewall not allowing receipt of the response object from the S3 request. We had no issues uploading assets to S3 from the same codebase on a remote server and are now looking into a work-around with the firewall.

> **Comments:**
> **username_3**: Looks like this is a problem that occurs every now and then, and we just ran into it now. So would it be possible to have a troubleshooting section for this in the Craft documentation?  

---

