1

I have a multi-site setup running within Craft 3. Everything seems to be working nicely, except for image transforms. For example:

The following transform on the default site works correctly:

https://www.default-site.com/index.php?p=actions/assets/generate-transform&transformId=10406

The second-site transform gives an internal server error 500

https://www.second-site.com/index.php?p=actions/assets/generate-transform&transformId=10406

My 'second-site' index.php has the following constants:

define('CRAFT_SITE', 'second-site');
define('CRAFT_BASE_PATH', '/home1/client-dir');
define('CRAFT_STORAGE_PATH', CRAFT_BASE_PATH.'/storage');
define('CRAFT_VENDOR_PATH', CRAFT_BASE_PATH.'/vendor');
define('CRAFT_TEMPLATES_PATH', CRAFT_BASE_PATH.'/templates');

I should note that I'm using Amazon S3 to serve my assets (using the S3 plugin). Also, the assets field is set to relate assets from the default site.

UPDATE: In my log file, I'm seeing the following error:

2020-10-01 20:25:27 [-][-][-][error][Error] Error: Call to a member function getVolume() on null in /home1/client-dir/vendor/craftcms/cms/src/services/AssetTransforms.php:648
Stack trace:
#0 /home1/client-dir/vendor/craftcms/cms/src/services/AssetTransforms.php(603): craft\services\AssetTransforms->_generateTransform(Object(craft\models\AssetTransformIndex))
#1 /home1/client-dir/vendor/craftcms/cms/src/controllers/AssetsController.php(1179): craft\services\AssetTransforms->ensureTransformUrlByIndexModel(Object(craft\models\AssetTransformIndex))
#2 [internal function]: craft\controllers\AssetsController->actionGenerateTransform(11357)
#3 /home1/client-dir/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#4 /home1/client-dir/vendor/yiisoft/yii2/base/Controller.php(157): yii\base\InlineAction->runWithParams(Array)
#5 /home1/client-dir/vendor/craftcms/cms/src/web/Controller.php(178): yii\base\Controller->runAction('generate-transf...', Array)
#6 /home1/client-dir/vendor/yiisoft/yii2/base/Module.php(528): craft\web\Controller->runAction('generate-transf...', Array)
#7 /home1/client-dir/vendor/craftcms/cms/src/web/Application.php(291): yii\base\Module->runAction('assets/generate...', Array)
#8 /home1/client-dir/vendor/craftcms/cms/src/web/Application.php(559): craft\web\Application->runAction('assets/generate...', Array)
#9 /home1/client-dir/vendor/craftcms/cms/src/web/Application.php(270): craft\web\Application->_processActionRequest(Object(craft\web\Request))
#10 /home1/client-dir/vendor/yiisoft/yii2/base/Application.php(386): craft\web\Application->handleRequest(Object(craft\web\Request))
#11 /home1/client-dir/public_html/second-site/index.php(28): yii\base\Application->run()
#12 {main}
2020-10-01 20:25:26 [-][-][-][info][application] $_GET = [
    'p' => 'actions/assets/generate-transform'
    'transformId' => '11357'
]

Craft Version: 3.4.24 Amazon S3 Plugin: 1.2.8

Has anyone else experienced this? Any ideas?

1 Answer 1

1

From Brandon Kelly on Discord:

If you go to the Assets index page and change the site to your second site. Are you able to see all the same assets there? (Specifically whatever ones appear to be causing this error on your second site)

They weren't listed.

Had a feeling that would be the case. That's your problem. If you run php craft resave/assets, does that fix it?

Yes it did! Thanks :-)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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