internetztube / craft-element-relations

Shows all relations of an element.
https://plugins.craftcms.com/element-relations
Other
2 stars 6 forks source link

Internal Server Error on relations fields within Assets #36

Closed stevehurst closed 4 months ago

stevehurst commented 4 months ago

On the latest upgrades to both Element Relations (3.0.3) and Craft (4.10.1), I'm getting an Internal Server Error popup when viewing any Asset entry page that has a relations field. If I remove it, it goes away. There is no clarity on what the error is.

Screenshot 2024-06-19 at 12 25 27 PM
internetztube commented 4 months ago

I‘m also running a Craft 4.10 application, and I‘m not running into this issue.

Would you be able to send your composer.json, composer.lock files, and database export to support@internetztube.net and point to the entry where you see this error triggered?

stevehurst commented 4 months ago

I emailed a link to the composer files and database backup. When I look at it locally, with dev mode on, I see this error:

Copy StacktraceSearch StackoverflowSearch GoogleException Unknown Method – yii\base\UnknownMethodException

Calling unknown method: craft\db\Connection::getIsMaria() 299300301302303304305306307308309310311312313314315316317 */ public function __call($name, $params) { $this->ensureBehaviors(); foreach ($this->_behaviors as $object) { if ($object->hasMethod($name)) { return call_user_func_array([$object, $name], $params); } } throw new UnknownMethodException('Calling unknown method: ' . get_class($this) . "::$name()"); }

/**
 * This method is called after the object is created by cloning an existing one.
 * It removes all behaviors because they are attached to the old object.
 */
public function __clone()
{
    $this->_events = [];

30313233343536373839404142 if ($db->getIsMysql()) { $path = $db->quoteValue( sprintf('$.%s', implode('.', array_map(fn(string $seg) => sprintf('"%s"', $seg), $path))) ); // Maria doesn't support ->/->> operators :( if ($db->getIsMaria()) { return "JSON_UNQUOTE(JSON_EXTRACT($column, $path))"; } return "($column->>$path)"; }

    if ($db->getIsPgsql()) {

11121314151617181920212223{ public static function isInUse(ElementInterface $element): bool { if (!Craft::$app->plugins->isPluginEnabled('seomatic') || !($element instanceof Asset)) { return false; } $columnSelector = self::dbJsonExtract("metaBundleSettings", ["seoImageIds"]);

    return (new Query())
        ->from([\nystudio107\seomatic\records\MetaBundle::tableName()])
        ->where(['=', $columnSelector, "[\"$element->id\"]"])
        ->collect()
        ->isNotEmpty();

23242526272829303132 $element = Craft::$app->elements->getElementById($elementId, null, $siteId); $template = "element-relations/_components/fields/relations" . ($isPreview ? "_preview" : "");

    return Craft::$app->getView()->renderTemplate($template, [
        "relations" => RelationsService::getRelations($element),
        "seomaticGlobal" => SpecialExtractorSeomaticGlobalService::isInUse($element),
    ]);
}

} 334335336337338339340341342343344345346 * @param string $route

  • @param array $params
  • @return BaseResponse|null The result of the action, normalized into a Response object */ public function runAction($route, $params = []): ?BaseResponse { $result = parent::runAction($route, $params);

    if ($result === null || $result instanceof BaseResponse) {
        return $result;
    }
    
    $response = $this->getResponse();

    635636637638639640641642643644645646647 if ($request->getIsActionRequest()) { $route = implode('/', $request->getActionSegments());

        try {
            Craft::debug("Route requested: '$route'", __METHOD__);
            $this->requestedRoute = $route;
            return $this->runAction($route, $_GET);
        } catch (Throwable $e) {
            $this->_unregisterDebugModule();
            if ($e instanceof InvalidRouteException) {
                throw new NotFoundHttpException(Craft::t('yii', 'Page not found.'), $e->getCode(), $e);
            }
            throw $e;

    296297298299300301302303304305306307308 } } } }

    // If this is an action request, call the controller
    if (($response = $this->_processActionRequest($request)) !== null) {
        return $response;
    }
    
    // If we’re still here, finally let Yii do its thing.
    try {
        return parent::handleRequest($request);

    6789101112// Load shared bootstrap require dirname(DIR) . '/bootstrap.php';

// Load and run Craft /* @var craft\web\Application $app / $app = require CRAFT_VENDOR_PATH . '/craftcms/cms/bootstrap/web.php'; $app->run(); $_GET = [ 'elementId' => '1057765', 'siteId' => '1', 'is-preview' => 'false', ];

$_COOKIE = [ '1031b8c41dfff97a311a7ac99863bdc5_identity' => 'ff4f514ee085d7a894d3d635ee022a98b2fc24eae785d9f96bd0762476bae470a:2:{i:0;s:41:"1031b8c41dfff97a311a7ac99863bdc5_identity";i:1;s:162:"[1,"[\"7hGPf18SHSMMTPdU7b0lxsdSt5yyuB7T_gKZuytkzICCAuoQwCRUTU8mnU1mSZJNrapqWPLgeqrCcsm4NetQA707CJrh-JG4R7TP\",null,\"43544f0c81a090558dc27390694769b1\"]",1209600]";}', 'CRAFT_CSRF_TOKEN' => '5768b5e7b64b946cc82bbc97e4786d223b8579f723493e67bd73ddaaf19cc4b3a:2:{i:0;s:16:"CRAFT_CSRF_TOKEN";i:1;s:147:"BgB2cKg6QglNd-8v0CnVSsBEBGgZ85vVcFuTGDCy|726e0c8fcf98eb9ac076927d45201b9a9c7c3b1410ca77e98271bfdcf84b7d46BgB2cKg6QglNd-8v0CnVSsBEBGgZ85vVcFuTGDCy|1";}', 'CraftSessionId' => '0e5b3958d01789de40f895a0f5a33db2', '_ga' => 'GA1.1.405234551.1718745721', '_ga_HVFVW3CB2N' => 'GS1.1.1718818045.2.1.1718818048.57.0.0', '_gcl_au' => '1.1.1946879061.1718745721', 'messagesUtk' => 'bb24b54264524a8aac859d4b470afbeb', 'pageviewCount' => '3', ];

$_SESSION = [ 'bd62416aa8538ede709019a5e113eea5flash' => [], '1031b8c41dfff97a311a7ac99863bdc5token' => '7hGPf18SHSMMTPdU7b0lxsdSt5yyuB7T_gKZuytkzICCAuoQwCRUTU8mnU1mSZJNrapqWPLgeqrCcsm4NetQA707CJrh-JG4R7TP', '1031b8c41dfff97a311a7ac99863bdc5id' => 1, 'authKey' => '["7hGPf18SHSMMTPdU7b0lxsdSt5yyuB7T_gKZuytkzICCAuoQwCRUTU8mnU1mSZJNrapqWPLgeqrCcsm4NetQA707CJrh-JG4R7TP",null,"43544f0c81a090558dc27390694769b1"]', 'duration' => 1209600, '1031b8c41dfff97a311a7ac99863bdc5expire' => 1720037933, ]; Yii Framework 2024-06-19, 15:18:53

nginx/1.24.0 Yii Framework/2.0.50

internetztube commented 4 months ago

Thanks for the Database dump and for reporting! Helped a lot! Just released 3.0.4! ☺️

composer update internetztube/craft-element-relations