fortrabbit / craft-object-storage

A Craft 3 plugin that integrates with fortrabbit's S3 compatible Object Storage
MIT License
3 stars 8 forks source link

Could not open create the stream for "[image file]" #20

Closed satcreative closed 6 months ago

satcreative commented 2 years ago

I have various volumes setup with fortrabbit Object Storage Volume, which has worked fine for a number of years; however, recently I have been seeing the error Could not open create the stream for "[image file]", in my local environment: Screenshot 2021-12-16 at 11 50 22

When I access the image (any image) in the Assets CP I can see a broken link image but when I 'Preview' or download the image I can see the image itself:

Screenshot 2021-12-16 at 11 49 05

This prevents me from viewing the frontend of the site until I remove the images from that entry.

The issue isn't present on the production site, which uses the same object storage; however, it has started to happen on the staging site, which is also hosted on Fortrabbit and again uses the same object storage.

Is this error related to the fortrabbit Object Storage Volume plugin/setup

Thanks

ostark commented 2 years ago

Can you provide the whole stack trace, at least 4 function calls up the chain?

satcreative commented 2 years ago

craft\errors\AssetException: Could not open create the stream for “bowling-video-poster.jpg” in /Users/garyvoss/Documents/Sites/_repos/HBG assets/hwb-craft/vendor/craftcms/cms/src/base/FlysystemVolume.php:189 Stack trace:

0 /Users/garyvoss/Documents/Sites/_repos/HBG assets/hwb-craft/vendor/craftcms/cms/src/base/FlysystemVolume.php(200): craft\base\FlysystemVolume->getFileStream('bowling-video-p...')

1 /Users/garyvoss/Documents/Sites/_repos/HBG assets/hwb-craft/vendor/spacecatninja/imager-x/src/models/LocalSourceImageModel.php(160): craft\base\FlysystemVolume->saveFileLocally('bowling-video-p...', '/Users/garyvoss...')

2 /Users/garyvoss/Documents/Sites/_repos/HBG assets/hwb-craft/vendor/spacecatninja/imager-x/src/transformers/CraftTransformer.php(157): spacecatninja\imagerx\models\LocalSourceImageModel->getLocalCopy()

3 /Users/garyvoss/Documents/Sites/_repos/HBG assets/hwb-craft/vendor/spacecatninja/imager-x/src/transformers/CraftTransformer.php(96): spacecatninja\imagerx\transformers\CraftTransformer->getTransformedImage(Object(spacecatninja\imagerx\models\LocalSourceImageModel), Array)

4 /Users/garyvoss/Documents/Sites/_repos/HBG assets/hwb-craft/vendor/spacecatninja/imager-x/src/services/ImagerService.php(472): spacecatninja\imagerx\transformers\CraftTransformer->transform(Object(craft\elements\Asset), Array)

5 /Users/garyvoss/Documents/Sites/_repos/HBG assets/hwb-craft/vendor/spacecatninja/imager-x/src/variables/ImagerVariable.php(38): spacecatninja\imagerx\services\ImagerService->transformImage(Object(craft\elements\Asset), Array, Array, Array)

6 /Users/garyvoss/Documents/Sites/_repos/HBG assets/hwb-craft/vendor/twig/twig/src/Extension/CoreExtension.php(1511): spacecatninja\imagerx\variables\ImagerVariable->transformImage(Object(craft\elements\Asset), 'bannerImage')

7 /Users/garyvoss/Documents/Sites/_repos/HBG assets/hwb-craft/vendor/craftcms/cms/src/helpers/Template.php(106): twig_get_attribute(Object(craft\web\twig\Environment), Object(Twig\Source), Object(spacecatninja\imagerx\variables\ImagerVariable), 'transformImage', Array, 'method', false, false)

8 /Users/garyvoss/Documents/Sites/_repos/HBG assets/hwb-craft/storage/runtime/compiled_templates/dc/dcc7d96962d850513f0ec8ac1bb0b520fa3e11da2d9b79f5a50a85da0dc863f3.php(94): craft\helpers\Template::attribute(Object(craft\web\twig\Environment), Object(Twig\Source), Object(spacecatninja\imagerx\variables\ImagerVariable), 'transformImage', Array, 'method')

9 /Users/garyvoss/Documents/Sites/_repos/HBG assets/hwb-craft/vendor/twig/twig/src/Template.php(405): __TwigTemplate_2e851634712d4b6a63bed2b01e9e2b3046179f6cc384a66ea8817574f1baea11->doDisplay(Array, Array)

10 /Users/garyvoss/Documents/Sites/_repos/HBG assets/hwb-craft/vendor/twig/twig/src/Template.php(378): Twig\Template->displayWithErrorHandling(Array, Array)

11 /Users/garyvoss/Documents/Sites/_repos/HBG assets/hwb-craft/storage/runtime/compiled_templates/21/21ee8cf83cc91f772e79d5e70d00360f356de1e6051878bf118d77320c425d05.php(560): Twig\Template->display(Array)

12 /Users/garyvoss/Documents/Sites/_repos/HBG assets/hwb-craft/vendor/twig/twig/src/Extension/CoreExtension.php(1114): __TwigTemplate_ef2842049579cecf74d309206c91e40747b7b4d0e3a7f4120ba245667ad98f66->macro_standardImage(Array)

13 /Users/garyvoss/Documents/Sites/_repos/HBG assets/hwb-craft/storage/runtime/compiled_templates/de/debf4f315bddf18590f7e83e113e70c8e412ee616ce5fc519af149fbb3e94c58.php(172): twig_call_macro(Object(__TwigTemplate_ef2842049579cecf74d309206c91e40747b7b4d0e3a7f4120ba245667ad98f66), 'macro_standardI...', Array, 62, Array, Object(Twig\Source))

14 /Users/garyvoss/Documents/Sites/_repos/HBG assets/hwb-craft/vendor/twig/twig/src/Template.php(405): __TwigTemplate_b302832056cba6194174808d1ea0e4a5b8a3c53f4ca4fd6b3f32f13f60a4d658->doDisplay(Array, Array)

15 /Users/garyvoss/Documents/Sites/_repos/HBG assets/hwb-craft/vendor/twig/twig/src/Template.php(378): Twig\Template->displayWithErrorHandling(Array, Array)

16 /Users/garyvoss/Documents/Sites/_repos/HBG assets/hwb-craft/storage/runtime/compiled_templates/44/444381c0ffde6b4e68d30dad29673446f1a2e4eefa63a36e52fbd4193c383584.php(827): Twig\Template->display(Array)

17 /Users/garyvoss/Documents/Sites/_repos/HBG assets/hwb-craft/vendor/twig/twig/src/Extension/CoreExtension.php(1114): __TwigTemplate_835764565f761984264590fef49bab5df2e8abecfbd7fcacf2816d0bf7763183->macro_top_banner(Array)

18 /Users/garyvoss/Documents/Sites/_repos/HBG assets/hwb-craft/storage/runtime/compiled_templates/55/55ab7c8f30ac033bc62d6a68bf6f39e95ec8b0cfaec0bac67e35925c6deb003b.php(89): twig_call_macro(Object(__TwigTemplate_835764565f761984264590fef49bab5df2e8abecfbd7fcacf2816d0bf7763183), 'macro_top_banne...', Array, 12, Array, Object(Twig\Source))

19 /Users/garyvoss/Documents/Sites/_repos/HBG assets/hwb-craft/vendor/twig/twig/src/Template.php(182): __TwigTemplate_decb34079dbd4f5bf5fdab027a069685c701ef1a5c445f4240ac888d740a5880->block_main(Array, Array)

20 /Users/garyvoss/Documents/Sites/_repos/HBG assets/hwb-craft/storage/runtime/compiled_templates/62/624b639ed54f51163f4a0d0d16d9e6a2778da24908e8c5d81d7860527db8b3ce.php(250): Twig\Template->displayBlock('main', Array, Array)

21 /Users/garyvoss/Documents/Sites/_repos/HBG assets/hwb-craft/vendor/twig/twig/src/Template.php(405): __TwigTemplate_121198d64aa2ca28dec8bbe27dc9b8dee0ace32d93a9efd8b26bbe3f94cdada1->doDisplay(Array, Array)

22 /Users/garyvoss/Documents/Sites/_repos/HBG assets/hwb-craft/vendor/twig/twig/src/Template.php(378): Twig\Template->displayWithErrorHandling(Array, Array)

23 /Users/garyvoss/Documents/Sites/_repos/HBG assets/hwb-craft/storage/runtime/compiled_templates/55/55ab7c8f30ac033bc62d6a68bf6f39e95ec8b0cfaec0bac67e35925c6deb003b.php(50): Twig\Template->display(Array, Array)

24 /Users/garyvoss/Documents/Sites/_repos/HBG assets/hwb-craft/vendor/twig/twig/src/Template.php(405): __TwigTemplate_decb34079dbd4f5bf5fdab027a069685c701ef1a5c445f4240ac888d740a5880->doDisplay(Array, Array)

25 /Users/garyvoss/Documents/Sites/_repos/HBG assets/hwb-craft/vendor/twig/twig/src/Template.php(378): Twig\Template->displayWithErrorHandling(Array, Array)

26 /Users/garyvoss/Documents/Sites/_repos/HBG assets/hwb-craft/vendor/twig/twig/src/Template.php(390): Twig\Template->display(Array)

27 /Users/garyvoss/Documents/Sites/_repos/HBG assets/hwb-craft/vendor/twig/twig/src/TemplateWrapper.php(45): Twig\Template->render(Array, Array)

28 /Users/garyvoss/Documents/Sites/_repos/HBG assets/hwb-craft/vendor/twig/twig/src/Environment.php(318): Twig\TemplateWrapper->render(Array)

29 /Users/garyvoss/Documents/Sites/_repos/HBG assets/hwb-craft/vendor/craftcms/cms/src/web/View.php(408): Twig\Environment->render('global/_entry', Array)

30 /Users/garyvoss/Documents/Sites/_repos/HBG assets/hwb-craft/vendor/craftcms/cms/src/web/View.php(461): craft\web\View->renderTemplate('global/_entry', Array)

31 /Users/garyvoss/Documents/Sites/_repos/HBG assets/hwb-craft/vendor/craftcms/cms/src/web/Controller.php(201): craft\web\View->renderPageTemplate('global/_entry', Array, 'site')

32 /Users/garyvoss/Documents/Sites/_repos/HBG assets/hwb-craft/vendor/craftcms/cms/src/controllers/TemplatesController.php(102): craft\web\Controller->renderTemplate('global/_entry', Array)

33 [internal function]: craft\controllers\TemplatesController->actionRender('global/_entry', Array)

34 /Users/garyvoss/Documents/Sites/_repos/HBG assets/hwb-craft/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)

35 /Users/garyvoss/Documents/Sites/_repos/HBG assets/hwb-craft/vendor/yiisoft/yii2/base/Controller.php(181): yii\base\InlineAction->runWithParams(Array)

36 /Users/garyvoss/Documents/Sites/_repos/HBG assets/hwb-craft/vendor/yiisoft/yii2/base/Module.php(534): yii\base\Controller->runAction('render', Array)

37 /Users/garyvoss/Documents/Sites/_repos/HBG assets/hwb-craft/vendor/craftcms/cms/src/web/Application.php(287): yii\base\Module->runAction('templates/rende...', Array)

38 /Users/garyvoss/Documents/Sites/_repos/HBG assets/hwb-craft/vendor/yiisoft/yii2/web/Application.php(104): craft\web\Application->runAction('templates/rende...', Array)

39 /Users/garyvoss/Documents/Sites/_repos/HBG assets/hwb-craft/vendor/craftcms/cms/src/web/Application.php(272): yii\web\Application->handleRequest(Object(craft\web\Request))

40 /Users/garyvoss/Documents/Sites/_repos/HBG assets/hwb-craft/vendor/yiisoft/yii2/base/Application.php(392): craft\web\Application->handleRequest(Object(craft\web\Request))

41 /Users/garyvoss/Documents/Sites/_repos/HBG assets/hwb-craft/web/index.php(23): yii\base\Application->run()

42 {main}

ostark commented 2 years ago

I think the error starts here https://github.com/craftcms/cms/blob/3.7.20/src/elements/Asset.php#L2231-L2233

The "temp file path" is not set properly. I don't know that the actual directive is, maybe you know ...

satcreative commented 2 years ago

Yeah, I think you're right. There's a similar issue documented on the Imager X repository https://github.com/spacecatninja/craft-imager-x/issues/103.

I disabled Imager X and the images loaded correctly, so it seems Imager X can't find the temporary file path to make it's transforms.

Thanks for having a look. Feel free to close this issue as it's seemingly unrelated.