<p>My answer to my own question: after exhausting all avenues I ended up having to abandon Heroku for this Craft site. I moved the Craft site over to a DV server at Media Temple, moved over the database, and everything is working fine.</p>

CC BY-SA 3.0
2016-11-14T20:05:16.353Z
2016-11-14T20:05:16.353Z
chrisyour
<p>Line 707 of <code>craft/app/services/AssetsService.php</code> in the <a href="https://craftcms.com/changelog#build2945" rel="nofollow">latest</a> Craft release references <code>$folder-&gt;sourceId</code>, which is where your error is occurring, so my guess is there is something incorrectly setup with your Asset source settings. I'd start by verifying those.</p>

CC BY-SA 3.0
2016-10-04T20:56:08.967Z
Hi Brad, thanks for your time. Where would I go about looking at the Asset source settings? Where does $folder->sourceId come from? Is it a disconnect between the records in the "Assets" section and the data connecting to S3? Or is it a relationship inside the Craft database?
chrisyour
CC BY-SA 3.0
2016-10-04T21:12:07.947Z
Specifically the ones under Settings->Assets (https://craftcms.com/docs/assets), but `craft/config/general.php` can influence those if you're using environment variables (https://craftcms.com/docs/multi-environment-configs#environment-specific-variables).
Brad Bell
CC BY-SA 3.0
2016-10-04T21:26:51.917Z
Ok. Here is my config/general.php file. I also confirmed that my S3 buckets and settings haven't changed.

return array(
  'cpTrigger' => 'admin',
  'omitScriptNameInUrls' => true,
  'useCompressedJs' => false,
  'userSessionDuration' => 'P2W',
  'useSecureCookies' => false,
  'devMode' => true,
  'maxUploadFileSize' => 16777216,
);
chrisyour
CC BY-SA 3.0
2016-10-04T21:28:34.630Z
Also, to further confuse the situation: HEROKU: Hangs on upload. DEV environment allows me to upload to S3, creating the asset record. Then on deletion, throws and error, deletes the assets record, but leaves the file on S3.
chrisyour
CC BY-SA 3.0
2016-10-05T05:04:14.713Z
So you're saying it worked before the 2.6 upgrade? I don't see anything in the release notes that changes any S3 functionality... wonder if something changed in your AWS credentials? Also possible you've ran out of disk space on your instance? (We've all been there.)
RitterKnight
CC BY-SA 3.0
2016-10-05T21:31:43.820Z
I bumped up my Heroku dynos up. Still no luck. I also created a new Asset type just to test with. Set up S3 for the new type of asset - with the same S3 credentials, chose my bucket from the dropdown. Still hangs.

My user.ini settings:

post_max_size = 64MB
upload_max_filesize = 100MB
max_input_vars = 2000
session.save_handler=memcached
memcached.sess_binary=1
session.save_path="PERSISTENT=myapp_session ${MEMCACHIER_SERVERS}"
memcached.sess_sasl_username=${MEMCACHIER_USERNAME}
memcached.sess_sasl_password=${MEMCACHIER_PASSWORD}
chrisyour
CC BY-SA 3.0
2016-10-04T20:29:25.377Z
2016-10-04T20:29:25.377Z
Brad Bell
<p>I just upgraded a fully functional Craft website to Craft 2.6. The site is hosted on Heroku with assets uploading to S3. So all of that has been working really well for about 10 months. Now I can't upload any more assets. When I choose a file from my computer, the upload hangs.</p>

<p>I get a console error:</p>

<pre><code>Failed to load resource: the server responded with a status of 500 (Internal Server Error)

https://www.example.com/index.php?p=admin/actions/assets/uploadFile Failed to load resource: the server responded with a status of 500 (Internal Server Error)
</code></pre>

<p>Here is the response body of the 500 error:</p>

<pre><code>&lt;h1&gt;PHP Error [500]&lt;/h1&gt;
&lt;p&gt;Trying to get property of non-object (/app/craft/app/services/AssetsService.php:707)&lt;/p&gt;
&lt;pre&gt;#0 /app/craft/app/etc/errors/ErrorHandler.php(184): Craft\ErrorHandler-&gt;handleError()
#1 /app/craft/app/framework/base/CErrorHandler.php(133): Craft\ErrorHandler-&gt;handleError()
#2 /app/craft/app/framework/base/CApplication.php(834): Craft\ErrorHandler-&gt;handle()
#3 /app/craft/app/etc/web/WebApp.php(688): Craft\WebApp-&gt;handleError()
#4 /app/craft/app/services/AssetsService.php(707): Craft\WebApp-&gt;handleError()
#5 /app/craft/app/controllers/AssetsController.php(52): Craft\AssetsService-&gt;uploadFile()
#6 /app/craft/app/framework/web/actions/CInlineAction.php(49): Craft\AssetsController-&gt;actionUploadFile()
#7 /app/craft/app/framework/web/CController.php(308): CInlineAction-&gt;runWithParams()
#8 /app/craft/app/framework/web/CController.php(286): Craft\AssetsController-&gt;runAction()
#9 /app/craft/app/framework/web/CController.php(265): Craft\AssetsController-&gt;runActionWithFilters()
#10 /app/craft/app/framework/web/CWebApplication.php(282): Craft\AssetsController-&gt;run()
#11 /app/craft/app/etc/web/WebApp.php(818): Craft\WebApp-&gt;runController()
#12 /app/craft/app/etc/web/WebApp.php(288): Craft\WebApp-&gt;_processActionRequest()
#13 /app/craft/app/framework/base/CApplication.php(185): Craft\WebApp-&gt;processRequest()
#14 /app/craft/app/index.php(62): Craft\WebApp-&gt;run()
#15 /app/public/index.php(19): require_once()
&lt;/pre&gt;
</code></pre>

<p>Any ideas? This happens when I try to upload an asset directly in the Assets section of Craft as well as uploading a new image to an Entry.</p>

<p>Thanks.</p>

<craft-pro>
Craft 2.6 Asset Upload 500 Error (on Heroku with Amazon S3)
# Craft 2.6 Asset Upload 500 Error (on Heroku with Amazon S3)

(Asked by: username_0 on 2016-10-04)

I just upgraded a fully functional Craft website to Craft 2.6. The site is hosted on Heroku with assets uploading to S3. So all of that has been working really well for about 10 months. Now I can't upload any more assets. When I choose a file from my computer, the upload hangs.
I get a console error:
Failed to load resource: the server responded with a status of 500 (Internal Server Error)

https://www.example.com/index.php?p=admin/actions/assets/uploadFile Failed to load resource: the server responded with a status of 500 (Internal Server Error)

Here is the response body of the 500 error:
PHP Error [500]
Trying to get property of non-object (/app/craft/app/services/AssetsService.php:707)
#0 /app/craft/app/etc/errors/ErrorHandler.php(184): Craft\ErrorHandler->handleError()
#1 /app/craft/app/framework/base/CErrorHandler.php(133): Craft\ErrorHandler->handleError()
#2 /app/craft/app/framework/base/CApplication.php(834): Craft\ErrorHandler->handle()
#3 /app/craft/app/etc/web/WebApp.php(688): Craft\WebApp->handleError()
#4 /app/craft/app/services/AssetsService.php(707): Craft\WebApp->handleError()
#5 /app/craft/app/controllers/AssetsController.php(52): Craft\AssetsService->uploadFile()
#6 /app/craft/app/framework/web/actions/CInlineAction.php(49): Craft\AssetsController->actionUploadFile()
#7 /app/craft/app/framework/web/CController.php(308): CInlineAction->runWithParams()
#8 /app/craft/app/framework/web/CController.php(286): Craft\AssetsController->runAction()
#9 /app/craft/app/framework/web/CController.php(265): Craft\AssetsController->runActionWithFilters()
#10 /app/craft/app/framework/web/CWebApplication.php(282): Craft\AssetsController->run()
#11 /app/craft/app/etc/web/WebApp.php(818): Craft\WebApp->runController()
#12 /app/craft/app/etc/web/WebApp.php(288): Craft\WebApp->_processActionRequest()
#13 /app/craft/app/framework/base/CApplication.php(185): Craft\WebApp->processRequest()
#14 /app/craft/app/index.php(62): Craft\WebApp->run()
#15 /app/public/index.php(19): require_once()


Any ideas? This happens when I try to upload an asset directly in the Assets section of Craft as well as uploading a new image to an Entry.
Thanks.

**Tags:** craft-pro

---

## 2 answers

### Answer by username_0 on 2016-11-14. Score: 1

My answer to my own question: after exhausting all avenues I ended up having to abandon Heroku for this Craft site. I moved the Craft site over to a DV server at Media Temple, moved over the database, and everything is working fine.


---

### Answer by username_1 on 2016-10-04. Score: 0

Line 707 of `craft/app/services/AssetsService.php` in the [latest](https://craftcms.com/changelog#build2945) Craft release references `$folder->sourceId`, which is where your error is occurring, so my guess is there is something incorrectly setup with your Asset source settings. I'd start by verifying those.

> **Comments:**
> **username_0**: Hi Brad, thanks for your time. Where would I go about looking at the Asset source settings? Where does $folder->sourceId come from? Is it a disconnect between the records in the "Assets" section and the data connecting to S3? Or is it a relationship inside the Craft database?  
> **username_1**: Specifically the ones under Settings->Assets (https://craftcms.com/docs/assets), but `craft/config/general.php` can influence those if you're using environment variables (https://craftcms.com/docs/multi-environment-configs#environment-specific-variables).  
> **username_0**: Ok. Here is my config/general.php file. I also confirmed that my S3 buckets and settings haven't changed.  return array(   'cpTrigger' => 'admin',   'omitScriptNameInUrls' => true,   'useCompressedJs' => false,   'userSessionDuration' => 'P2W',   'useSecureCookies' => false,   'devMode' => true,   'maxUploadFileSize' => 16777216, );  
> **username_0**: Also, to further confuse the situation: HEROKU: Hangs on upload. DEV environment allows me to upload to S3, creating the asset record. Then on deletion, throws and error, deletes the assets record, but leaves the file on S3.  
> **username_2**: So you're saying it worked before the 2.6 upgrade? I don't see anything in the release notes that changes any S3 functionality... wonder if something changed in your AWS credentials? Also possible you've ran out of disk space on your instance? (We've all been there.)  
> **username_0**: I bumped up my Heroku dynos up. Still no luck. I also created a new Asset type just to test with. Set up S3 for the new type of asset - with the same S3 credentials, chose my bucket from the dropdown. Still hangs.  My user.ini settings:  post_max_size = 64MB upload_max_filesize = 100MB max_input_vars = 2000 session.save_handler=memcached memcached.sess_binary=1 session.save_path="PERSISTENT=myapp_session ${MEMCACHIER_SERVERS}" memcached.sess_sasl_username=${MEMCACHIER_USERNAME} memcached.sess_sasl_password=${MEMCACHIER_PASSWORD}  

---

