ryssbowh / craft-activity

Other
3 stars 0 forks source link

[BUG] Error in the activity log if an event of the type "assetCreated" exists #15

Closed mihob closed 1 year ago

mihob commented 1 year ago

There is an internal server error on the activity log if an event of the type "assetCreated" is present. Here is the complete trace:

[yii\base\ErrorException:2] Array to string conversion 
{
    "trace":
    [
        "#0 /app/vendor/craftcms/cms/src/web/ErrorHandler.php(79): yii\\base\\ErrorHandler->handleError(2, 'Array to string...', '/app/vendor/twi...', 730)",
        "#1 [internal function]: craft\\web\\ErrorHandler->handleError(2, 'Array to string...', '/app/vendor/twi...', 730)","#2 /app/vendor/twig/twig/src/Extension/CoreExtension.php(730): implode(', ', Array)",
        "#3 /app/storage/runtime/compiled_templates/eb/eb7bf95d4a03022ef9d7ea23417f7995f6c6a70a86d3acf857c54c52c7c2bf4b.php(278): twig_join_filter(Array, ', ')",
        "#4 /app/vendor/twig/twig/src/Extension/CoreExtension.php(1202): __TwigTemplate_cf43d2222c55849716f80f63c7e7748dc3771f57056d9c92eda9d6af786dc4a3->macro_elementValue(Array)",
        "#5 /app/storage/runtime/compiled_templates/eb/eb7bf95d4a03022ef9d7ea23417f7995f6c6a70a86d3acf857c54c52c7c2bf4b.php(317): twig_call_macro(Object(__TwigTemplate_cf43d2222c55849716f80f63c7e7748dc3771f57056d9c92eda9d6af786dc4a3), 'macro_elementVa...', Array, 48, Array, Object(Twig\\Source))",
        "#6 /app/vendor/twig/twig/src/Extension/CoreExtension.php(1202): __TwigTemplate_cf43d2222c55849716f80f63c7e7748dc3771f57056d9c92eda9d6af786dc4a3->macro_elementToValue(Array)",
        "#7 /app/storage/runtime/compiled_templates/eb/eb7bf95d4a03022ef9d7ea23417f7995f6c6a70a86d3acf857c54c52c7c2bf4b.php(408): twig_call_macro(Object(__TwigTemplate_cf43d2222c55849716f80f63c7e7748dc3771f57056d9c92eda9d6af786dc4a3), 'macro_elementTo...', Array, 72, Array, Object(Twig\\Source))",
        "#8 /app/vendor/twig/twig/src/Extension/CoreExtension.php(1202): __TwigTemplate_cf43d2222c55849716f80f63c7e7748dc3771f57056d9c92eda9d6af786dc4a3->macro_elementField(Object(Ryssbowh\\Activity\\models\\ChangedField))",
        "#9 /app/storage/runtime/compiled_templates/74/7448017b8b43f2ccd76bb0d88aadaa065521598f446d3747dea1859ceb63fa8a.php(53): twig_call_macro(Object(__TwigTemplate_cf43d2222c55849716f80f63c7e7748dc3771f57056d9c92eda9d6af786dc4a3), 'macro_elementFi...', Array, 6, Array, Object(Twig\\Source))",
        "#10 /app/vendor/twig/twig/src/Template.php(394): __TwigTemplate_8d9e43827884cf040f07e91ab7061d81e3168dc6410ec3475b8462d29204e94c->doDisplay(Array, Array)",
        "#11 /app/vendor/twig/twig/src/Template.php(367): Twig\\Template->displayWithErrorHandling(Array, Array)",
        "#12 /app/vendor/twig/twig/src/Template.php(379): Twig\\Template->display(Array)",
        "#13 /app/vendor/twig/twig/src/TemplateWrapper.php(40): Twig\\Template->render(Array, Array)",
        "#14 /app/vendor/twig/twig/src/Environment.php(277): Twig\\TemplateWrapper->render(Array)",
        "#15 /app/vendor/craftcms/cms/src/web/View.php(456): Twig\\Environment->render('activity/descri...', Array)",
        "#16 /app/vendor/ryssbowh/craft-activity/src/base/logs/ElementLog.php(35): craft\\web\\View->renderTemplate('activity/descri...', Array)",
        "#17 /app/vendor/yiisoft/yii2/base/Component.php(139): Ryssbowh\\Activity\\base\\logs\\ElementLog->getDescription()",
        "#18 /app/vendor/craftcms/cms/src/helpers/Template.php(135): yii\\base\\Component->__get('description')",
        "#19 /app/storage/runtime/compiled_templates/9a/9ac4fed47976bea5bb2551190aa7f9f0ce36b5e7bb5b61c8234b70c540e21551.php(43): craft\\helpers\\Template::attribute(Object(craft\\web\\twig\\Environment), Object(Twig\\Source), Object(Ryssbowh\\Activity\\models\\logs\\assets\\AssetCreated), 'description', Array)",
        "#20 /app/vendor/twig/twig/src/Template.php(394): __TwigTemplate_458cac61d10aee06e1d6fe425c7315c42c6f1647f18f93998e0bc30d136c62fd->doDisplay(Array, Array)",
        "#21 /app/vendor/twig/twig/src/Template.php(367): Twig\\Template->displayWithErrorHandling(Array, Array)",
        "#22 /app/storage/runtime/compiled_templates/33/33bb9262b9d94c37df7fcb15952c64acb005efdddcbbfa08099ce56e405a4bef.php(356): Twig\\Template->display(Array)",
        "#23 /app/vendor/twig/twig/src/Template.php(171): __TwigTemplate_54425997fd8886cbe2170b0fd2d6ef939069331702a887d21295c6562900c89a->block_content(Array, Array)",
        "#24 /app/storage/runtime/compiled_templates/33/339ee58ded2b1c71bcb289ec809be91e5ebf2f6020a3e5aea0d36de2b8bac78e.php(592): Twig\\Template->displayBlock('content', Array, Array)",
        "#25 /app/vendor/twig/twig/src/Template.php(171): __TwigTemplate_2f2ca38727818b4d734af5afbecc7fc7d0856d149842ce3f04b337b45e938b15->block_main(Array, Array)",
        "#26 /app/storage/runtime/compiled_templates/33/339ee58ded2b1c71bcb289ec809be91e5ebf2f6020a3e5aea0d36de2b8bac78e.php(376): Twig\\Template->displayBlock('main', Array, Array)",
        "#27 /app/vendor/twig/twig/src/Template.php(171): __TwigTemplate_2f2ca38727818b4d734af5afbecc7fc7d0856d149842ce3f04b337b45e938b15->block_body(Array, Array)",
        "#28 /app/storage/runtime/compiled_templates/c7/c733b3ceaa3a678a63ced166282dbe4f61bc34a7c13ef9cd1e819f30544b0e50.php(94): Twig\\Template->displayBlock('body', Array, Array)",
        "#29 /app/vendor/twig/twig/src/Template.php(394): __TwigTemplate_77c85e3e9ee84ec73b84724f47bdac95e5122e63324999f3889de8d2f07c6946->doDisplay(Array, Array)",
        "#30 /app/vendor/twig/twig/src/Template.php(367): Twig\\Template->displayWithErrorHandling(Array, Array)",
        "#31 /app/storage/runtime/compiled_templates/e3/e3cfd342eb848f5a0490261ffb289cd6d29ecff3d72d968aa543d045f86f2145.php(56): Twig\\Template->display(Array, Array)",
        "#32 /app/vendor/twig/twig/src/Template.php(394): __TwigTemplate_1b22249323801c8949079a668e4cb1e7e3143aef7d0173effec8d482949e4f84->doDisplay(Array, Array)",
        "#33 /app/vendor/twig/twig/src/Template.php(367): Twig\\Template->displayWithErrorHandling(Array, Array)",
        "#34 /app/storage/runtime/compiled_templates/33/339ee58ded2b1c71bcb289ec809be91e5ebf2f6020a3e5aea0d36de2b8bac78e.php(179): Twig\\Template->display(Array, Array)",
        "#35 /app/vendor/twig/twig/src/Template.php(394): __TwigTemplate_2f2ca38727818b4d734af5afbecc7fc7d0856d149842ce3f04b337b45e938b15->doDisplay(Array, Array)",
        "#36 /app/vendor/twig/twig/src/Template.php(367): Twig\\Template->displayWithErrorHandling(Array, Array)",
        "#37 /app/storage/runtime/compiled_templates/33/33bb9262b9d94c37df7fcb15952c64acb005efdddcbbfa08099ce56e405a4bef.php(56): Twig\\Template->display(Array, Array)",
        "#38 /app/vendor/twig/twig/src/Template.php(394): __TwigTemplate_54425997fd8886cbe2170b0fd2d6ef939069331702a887d21295c6562900c89a->doDisplay(Array, Array)",
        "#39 /app/vendor/twig/twig/src/Template.php(367): Twig\\Template->displayWithErrorHandling(Array, Array)",
        "#40 /app/vendor/twig/twig/src/Template.php(379): Twig\\Template->display(Array)",
        "#41 /app/vendor/twig/twig/src/TemplateWrapper.php(40): Twig\\Template->render(Array, Array)",
        "#42 /app/vendor/twig/twig/src/Environment.php(277): Twig\\TemplateWrapper->render(Array)",
        "#43 /app/vendor/craftcms/cms/src/web/View.php(456): Twig\\Environment->render('activity/activi...', Array)",
        "#44 /app/vendor/craftcms/cms/src/web/View.php(509): craft\\web\\View->renderTemplate('activity/activi...', Array)",
        "#45 /app/vendor/craftcms/cms/src/web/TemplateResponseFormatter.php(56): craft\\web\\View->renderPageTemplate('activity/activi...', Array, 'cp')",
        "#46 /app/vendor/yiisoft/yii2/web/Response.php(1098): craft\\web\\TemplateResponseFormatter->format(Object(craft\\web\\Response))",
        "#47 /app/vendor/craftcms/cms/src/web/Response.php(286): yii\\web\\Response->prepare()",
        "#48 /app/vendor/yiisoft/yii2/web/Response.php(339): craft\\web\\Response->prepare()",
        "#49 /app/vendor/yiisoft/yii2/base/Application.php(390): yii\\web\\Response->send()",
        "#50 /app/web/index.php(27): yii\\base\\Application->run()",
        "#51 {main}"
    ],
    "memory":13764368,
    "exception":"[object] (yii\\base\\ErrorException(code: 2): Array to string conversion at /app/vendor/twig/twig/src/Extension/CoreExtension.php:730)"
}
ryssbowh commented 1 year ago

I can't reproduce this, what custom fields do you have on your volume ?

I made some changes in 2.3.10, if such a situation happens you should now see an *error* somewhere in the description. If that's the case please forward your web log to support@puzzlers.run and I can see what is actually happening.

mihob commented 1 year ago

We use the Image Optimize Plugin with corresponding fields of type OptimizedImages on the asset.

I can't access the /activity page because of the Internal Server Error. Therefore I can only provide the trace:

Array to string conversion {
    "trace":[
        "#0 /app/vendor/craftcms/cms/src/web/ErrorHandler.php(79): yii\\base\\ErrorHandler->handleError(2, 'Array to string...', '/app/vendor/rys...', 56)
        "#1 [internal function]: craft\\web\\ErrorHandler->handleError(2, 'Array to string...', '/app/vendor/rys...', 56)
        "#2 /app/vendor/ryssbowh/craft-activity/src/twig/TwigActivity.php(56): implode(', ', Array)
        "#3 /app/vendor/twig/twig/src/Extension/CoreExtension.php(1607): Ryssbowh\\Activity\\twig\\TwigActivity->elementValue(Array)
        "#4 /app/vendor/craftcms/cms/src/helpers/Template.php(146): twig_get_attribute(Object(craft\\web\\twig\\Environment), Object(Twig\\Source), Object(Ryssbowh\\Activity\\twig\\TwigActivity), 'elementValue', Array, 'method', false, false)
        "#5 /app/storage/runtime/compiled_templates/eb/eb7bf95d4a03022ef9d7ea23417f7995f6c6a70a86d3acf857c54c52c7c2bf4b.php(275): craft\\helpers\\Template::attribute(Object(craft\\web\\twig\\Environment), Object(Twig\\Source), Object(Ryssbowh\\Activity\\twig\\TwigActivity), 'elementValue', Array, 'method')
        "#6 /app/vendor/twig/twig/src/Extension/CoreExtension.php(1202): __TwigTemplate_cf43d2222c55849716f80f63c7e7748dc3771f57056d9c92eda9d6af786dc4a3->macro_elementValue(Array)
        "#7 /app/storage/runtime/compiled_templates/eb/eb7bf95d4a03022ef9d7ea23417f7995f6c6a70a86d3acf857c54c52c7c2bf4b.php(302): twig_call_macro(Object(__TwigTemplate_cf43d2222c55849716f80f63c7e7748dc3771f57056d9c92eda9d6af786dc4a3), 'macro_elementVa...', Array, 43, Array, Object(Twig\\Source))
        "#8 /app/vendor/twig/twig/src/Extension/CoreExtension.php(1202): __TwigTemplate_cf43d2222c55849716f80f63c7e7748dc3771f57056d9c92eda9d6af786dc4a3->macro_elementToValue(Array)
        "#9 /app/storage/runtime/compiled_templates/eb/eb7bf95d4a03022ef9d7ea23417f7995f6c6a70a86d3acf857c54c52c7c2bf4b.php(393): twig_call_macro(Object(__TwigTemplate_cf43d2222c55849716f80f63c7e7748dc3771f57056d9c92eda9d6af786dc4a3), 'macro_elementTo...', Array, 67, Array, Object(Twig\\Source))
        "#10 /app/vendor/twig/twig/src/Extension/CoreExtension.php(1202): __TwigTemplate_cf43d2222c55849716f80f63c7e7748dc3771f57056d9c92eda9d6af786dc4a3->macro_elementField(Object(Ryssbowh\\Activity\\models\\ChangedField))
        "#11 /app/storage/runtime/compiled_templates/74/7448017b8b43f2ccd76bb0d88aadaa065521598f446d3747dea1859ceb63fa8a.php(53): twig_call_macro(Object(__TwigTemplate_cf43d2222c55849716f80f63c7e7748dc3771f57056d9c92eda9d6af786dc4a3), 'macro_elementFi...', Array, 6, Array, Object(Twig\\Source))
        "#12 /app/vendor/twig/twig/src/Template.php(394): __TwigTemplate_8d9e43827884cf040f07e91ab7061d81e3168dc6410ec3475b8462d29204e94c->doDisplay(Array, Array)
        "#13 /app/vendor/twig/twig/src/Template.php(367): Twig\\Template->displayWithErrorHandling(Array, Array)
        "#14 /app/vendor/twig/twig/src/Template.php(379): Twig\\Template->display(Array)
        "#15 /app/vendor/twig/twig/src/TemplateWrapper.php(40): Twig\\Template->render(Array, Array)
        "#16 /app/vendor/twig/twig/src/Environment.php(277): Twig\\TemplateWrapper->render(Array)
        "#17 /app/vendor/craftcms/cms/src/web/View.php(456): Twig\\Environment->render('activity/descri...', Array)
        "#18 /app/vendor/ryssbowh/craft-activity/src/base/logs/ElementLog.php(35): craft\\web\\View->renderTemplate('activity/descri...', Array)
        "#19 /app/vendor/yiisoft/yii2/base/Component.php(139): Ryssbowh\\Activity\\base\\logs\\ElementLog->getDescription()
        "#20 /app/vendor/craftcms/cms/src/helpers/Template.php(135): yii\\base\\Component->__get('description')
        "#21 /app/storage/runtime/compiled_templates/9a/9ac4fed47976bea5bb2551190aa7f9f0ce36b5e7bb5b61c8234b70c540e21551.php(43): craft\\helpers\\Template::attribute(Object(craft\\web\\twig\\Environment), Object(Twig\\Source), Object(Ryssbowh\\Activity\\models\\logs\\assets\\AssetCreated), 'description', Array)
        "#22 /app/vendor/twig/twig/src/Template.php(394): __TwigTemplate_458cac61d10aee06e1d6fe425c7315c42c6f1647f18f93998e0bc30d136c62fd->doDisplay(Array, Array)
        "#23 /app/vendor/twig/twig/src/Template.php(367): Twig\\Template->displayWithErrorHandling(Array, Array)
        "#24 /app/storage/runtime/compiled_templates/33/33bb9262b9d94c37df7fcb15952c64acb005efdddcbbfa08099ce56e405a4bef.php(356): Twig\\Template->display(Array)
        "#25 /app/vendor/twig/twig/src/Template.php(171): __TwigTemplate_54425997fd8886cbe2170b0fd2d6ef939069331702a887d21295c6562900c89a->block_content(Array, Array)
        "#26 /app/storage/runtime/compiled_templates/33/339ee58ded2b1c71bcb289ec809be91e5ebf2f6020a3e5aea0d36de2b8bac78e.php(592): Twig\\Template->displayBlock('content', Array, Array)
        "#27 /app/vendor/twig/twig/src/Template.php(171): __TwigTemplate_2f2ca38727818b4d734af5afbecc7fc7d0856d149842ce3f04b337b45e938b15->block_main(Array, Array)
        "#28 /app/storage/runtime/compiled_templates/33/339ee58ded2b1c71bcb289ec809be91e5ebf2f6020a3e5aea0d36de2b8bac78e.php(376): Twig\\Template->displayBlock('main', Array, Array)
        "#29 /app/vendor/twig/twig/src/Template.php(171): __TwigTemplate_2f2ca38727818b4d734af5afbecc7fc7d0856d149842ce3f04b337b45e938b15->block_body(Array, Array)
        "#30 /app/storage/runtime/compiled_templates/c7/c733b3ceaa3a678a63ced166282dbe4f61bc34a7c13ef9cd1e819f30544b0e50.php(94): Twig\\Template->displayBlock('body', Array, Array)
        "#31 /app/vendor/twig/twig/src/Template.php(394): __TwigTemplate_77c85e3e9ee84ec73b84724f47bdac95e5122e63324999f3889de8d2f07c6946->doDisplay(Array, Array)
        "#32 /app/vendor/twig/twig/src/Template.php(367): Twig\\Template->displayWithErrorHandling(Array, Array)
        "#33 /app/storage/runtime/compiled_templates/e3/e3cfd342eb848f5a0490261ffb289cd6d29ecff3d72d968aa543d045f86f2145.php(56): Twig\\Template->display(Array, Array)
        "#34 /app/vendor/twig/twig/src/Template.php(394): __TwigTemplate_1b22249323801c8949079a668e4cb1e7e3143aef7d0173effec8d482949e4f84->doDisplay(Array, Array)
        "#35 /app/vendor/twig/twig/src/Template.php(367): Twig\\Template->displayWithErrorHandling(Array, Array)
        "#36 /app/storage/runtime/compiled_templates/33/339ee58ded2b1c71bcb289ec809be91e5ebf2f6020a3e5aea0d36de2b8bac78e.php(179): Twig\\Template->display(Array, Array)
        "#37 /app/vendor/twig/twig/src/Template.php(394): __TwigTemplate_2f2ca38727818b4d734af5afbecc7fc7d0856d149842ce3f04b337b45e938b15->doDisplay(Array, Array)
        "#38 /app/vendor/twig/twig/src/Template.php(367): Twig\\Template->displayWithErrorHandling(Array, Array)
        "#39 /app/storage/runtime/compiled_templates/33/33bb9262b9d94c37df7fcb15952c64acb005efdddcbbfa08099ce56e405a4bef.php(56): Twig\\Template->display(Array, Array)
        "#40 /app/vendor/twig/twig/src/Template.php(394): __TwigTemplate_54425997fd8886cbe2170b0fd2d6ef939069331702a887d21295c6562900c89a->doDisplay(Array, Array)
        "#41 /app/vendor/twig/twig/src/Template.php(367): Twig\\Template->displayWithErrorHandling(Array, Array)
        "#42 /app/vendor/twig/twig/src/Template.php(379): Twig\\Template->display(Array)
        "#43 /app/vendor/twig/twig/src/TemplateWrapper.php(40): Twig\\Template->render(Array, Array)
        "#44 /app/vendor/twig/twig/src/Environment.php(277): Twig\\TemplateWrapper->render(Array)
        "#45 /app/vendor/craftcms/cms/src/web/View.php(456): Twig\\Environment->render('activity/activi...', Array)
        "#46 /app/vendor/craftcms/cms/src/web/View.php(509): craft\\web\\View->renderTemplate('activity/activi...', Array)
        "#47 /app/vendor/craftcms/cms/src/web/TemplateResponseFormatter.php(56): craft\\web\\View->renderPageTemplate('activity/activi...', Array, 'cp')
        "#48 /app/vendor/yiisoft/yii2/web/Response.php(1098): craft\\web\\TemplateResponseFormatter->format(Object(craft\\web\\Response))
        "#49 /app/vendor/craftcms/cms/src/web/Response.php(286): yii\\web\\Response->prepare()
        "#50 /app/vendor/yiisoft/yii2/web/Response.php(339): craft\\web\\Response->prepare()
        "#51 /app/vendor/yiisoft/yii2/base/Application.php(390): yii\\web\\Response->send()
        "#52 /app/web/index.php(27): yii\\base\\Application->run()
        "#53 {main}"
    ],
    "memory":14270808,
    "exception":"[object] (yii\\base\\ErrorException(code: 2): Array to string conversion at /app/vendor/ryssbowh/craft-activity/src/twig/TwigActivity.php:56)"
}
ryssbowh commented 1 year ago

I see, managed to reproduce this and fixed it in 2.3.11