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:

<h1>PHP Error [500]</h1>
<p>Trying to get property of non-object (/app/craft/app/services/AssetsService.php:707)</p>
<pre>#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.



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.


Line 707 of craft/app/services/AssetsService.php in the latest 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.

  • 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
    Oct 4 '16 at 20:56
  • Specifically the ones under Settings->Assets (craftcms.com/docs/assets), but craft/config/general.php can influence those if you're using environment variables (craftcms.com/docs/…).
    – Brad Bell
    Oct 4 '16 at 21:12
  • 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
    Oct 4 '16 at 21:26
  • 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
    Oct 4 '16 at 21:28
  • 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.) Oct 5 '16 at 5:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.