0

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()
</pre>

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.

chrisyour
  • 83
  • 5

2 Answers2

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.

chrisyour
  • 83
  • 5
0

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.

Brad Bell
  • 67,440
  • 6
  • 73
  • 143
  • 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 04 '16 at 20:56
  • 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 Oct 04 '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 04 '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 04 '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.) – RitterKnight Oct 05 '16 at 05:04
  • 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 Oct 05 '16 at 21:31