J

Tag: Archbio

  • Módulo Views Field View (Global views) no funciona en Drupal 11.4.5 (fixed)

    drupal global view Error message Oops, something went wrong. Check your browser’s developer console for more details.

    The “Oops, something went wrong. Check your browser’s developer console for more details.” error in Drupal is a generic frontend warning introduced in Drupal 10.1 to signal that a background AJAX request has failed. When building or interacting with Views, this usually points to a backend PHP exception, a 500 Internal Server Error, or memory exhaustion disguised as a Javascript failure. [1, 2, 3, 4]
    To resolve this issue, you must bypass the generic wrapper and pinpoint the underlying PHP or module error.

    🛠️ Step 1: Reveal the Real Error Code
    The frontend message does not contain the root cause. You must pull the explicit error trace.
      • Check the Browser Console: Press F12 (or right-click and select Inspect), navigate to the Console tab, and look for red text reading Uncaught Drupal.AjaxError. [1, 2]
      • Inspect the Network Payload: Go to the Network tab in DevTools, trigger the error again, click on the failed request (highlighted in red, often returning a 500 status), and check its Response or Preview tab for the raw PHP error. [1, 2]
      • Check Drupal’s Database Logs (DbLog): If you have administrative access, navigate to /admin/reports/dblog to look for recent PHP, Apache, or Views errors recorded at the exact timestamp of the failure.


    🔍 Step 2: Apply the Correct Fix
    Once you identify the backend error type from Step 1, apply the corresponding fix:
    1. The Pager/Memory Limit Issue (High Item Count)
      • The Cause: If you are building a View or using a preview that displays thousands of rows at once, the server may run out of memory or exceed max processing variables. [1]
      • The Fix: Go to your View configuration. Under Pager, change Use Pager from displaying all items to a lower, paginated limit (e.g., 10, 20, or 50 items). [1]

    2. Exposed Filter with AJAX Bug
      • The Cause: Enabling AJAX on a View with certain combinations of exposed filters or sorting options can cause a known core layout breakage. [1]
      • The Fix: In the View settings panel under Advanced, toggle Use AJAX to No. If AJAX is strictly necessary, ensure your Drupal core is updated to its latest minor version or search for active patches in the Drupal Core Issue Queue.

    3. Module Conflicts (Metatag, VBO, or Layout Builder)
      • The Cause: Contributed modules like Metatag Views, Views Bulk Operations, or Layout Builder Tabs frequently trigger this AJAX crash when rendering previews.
      • The Fix: Temporarily disable the suspected module to isolate it. Check the module’s issue queue on Drupal.org for specific compatibility patches matching your current core version. [1, 2, 3]

    4. Turn on Local Verbose Logging
      • The Cause: Production sites are configured to mask explicit errors from end-users, forcing Drupal to display the generic “Oops” screen.
      • The Fix: If you are developing locally, navigate to /admin/config/development/logging. Change Error messages to display to All messages to print the exact file line numbers and plugin exceptions directly on your screen. [1]


    If you can grab the specific error text, tell me:
      • The exact PHP text, StatusText, or error code from your browser console
      • Your exact Drupal core version
      • Whether this happens in the Views UI editor or on the live frontend page [1, 2, 3, 4, 5]

    I can give you the exact patch or configuration tweak needed for that specific module conflict!

    ——————————————-

    When I want to handle a global view in the views drupal backend, I get this error in the browser’s developer console: POST https://archbio.miami.edu/admin/structure/views/ajax/handler/people_details/block_1/field/view_2?_wrapper_format=drupal_ajax Status 500 VersionHTTP/2 Transferred1.35 kB (837 B size) Referrer Policystrict-origin-when-cross-origin Request PriorityHighest DNS ResolutionDNS over HTTPS Uncaught Object { message: “\nAn AJAX HTTP error occurred.\nHTTP Result Code: 500\nDebugging information follows.\nPath: /admin/structure/views/ajax/handler/people_details/block_1/field/view_2\nStatusText: error\nResponseText: The website encountered an unexpected error. Try again later.Error: Call to undefined function Drupal\\views_field_view\\Plugin\\views\\field\\views_ui_build_form_url() in Drupal\\views_field_view\\Plugin\\views\\field\\View->buildOptionsForm() (line 120 of modules/contrib/views_field_view/src/Plugin/views/field/View.php). Drupal\\views_ui\\Form\\Ajax\\ConfigHandler->buildForm()\ncall_user_func_array() (Line: 559)\nDrupal\\Core\\Form\\FormBuilder->retrieveForm() (Line: 299)\nDrupal\\Core\\Form\\FormBuilder->buildForm() (Line: 227)\nDrupal\\views_ui\\Form\\Ajax\\ViewsFormBase->Drupal\\views_ui\\Form\\Ajax\\{closure}() (Line: 638)\nDrupal\\Core\\Render\\Renderer::Drupal\\Core\\Render\\{closure}()\nFiber->start() (Line: 639)\nDrupal\\Core\\Render\\Renderer->executeInRenderContext() (Line: 229)\nDrupal\\views_ui\\Form\\Ajax\\ViewsFormBase->ajaxFormWrapper() (Line: 134)\nDrupal\\views_ui\\Form\\Ajax\\ViewsFormBase->getForm() (Line: 39)\nDrupal\\views_ui\\Form\\Ajax\\ConfigHandler->getForm()\ncall_user_func_array() (Line: 123)\nDrupal\\Core\\EventSubscriber\\EarlyRenderingControllerWrapperSubscriber->Drupal\\Core\\EventSubscriber\\{closure}() (Line: 638)\nDrupal\\Core\\Render\\Renderer::Drupal\\Core\\Render\\{closure}()\nFiber->start() (Line: 639)\nDrupal\\Core\\Render\\Renderer->executeInRenderContext() (Line: 121)\nDrupal\\Core\\EventSubscriber\\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext() (Line: 97)\nDrupal\\Core\\EventSubscriber\\EarlyRenderingControllerWrapperSubscriber->Drupal\\Core\\EventSubscriber\\{closure}() (Line: 183)\nSymfony\\Component\\HttpKernel\\HttpKernel->handleRaw() (Line: 76)\nSymfony\\Component\\HttpKernel\\HttpKernel->handle() (Line: 53)\nDrupal\\Core\\StackMiddleware\\Session->handle() (Line: 30)\nDrupal\\Core\\StackMiddleware\\KernelPreHandle->handle() (Line: 28)\nDrupal\\Core\\StackMiddleware\\ContentLength->handle() (Line: 32)\nDrupal\\big_pipe\\StackMiddleware\\ContentLength->handle() (Line: 118)\nDrupal\\page_cache\\StackMiddleware\\PageCache->pass() (Line: 92)\nDrupal\\page_cache\\StackMiddleware\\PageCache->handle() (Line: 53)\nAsm89\\Stack\\Cors->handle() (Line: 48)\nDrupal\\Core\\StackMiddleware\\ReverseProxyMiddleware->handle() (Line: 51)\nDrupal\\Core\\StackMiddleware\\NegotiationMiddleware->handle() (Line: 71)\nDrupal\\Core\\StackMiddleware\\AjaxPageState->handle() (Line: 54)\nDrupal\\Core\\StackMiddleware\\StackedHttpKernel->handle() (Line: 753)\nDrupal\\Core\\DrupalKernel->handle() (Line: 34)\nSymfony\\Component\\Runtime\\Runner\\Symfony\\HttpKernelRunner->run() (Line: 32)\nrequire(‘/var/www/archbio.miami.edu/html/drupal-11/vendor/autoload_runtime.php’) (Line: 22)\nrequire_once(‘/var/www/archbio.miami.edu/html/drupal-11/web/autoload_runtime.php’) (Line: 13)\n”, name: “AjaxError”, stack: “” } ajax.js:1224:11 error https://archbio.miami.edu/core/misc/ajax.js?v=11.4.5:1224 complete https://archbio.miami.edu/core/misc/ajax.js?v=11.4.5:613 jQuery 6 eventResponse https://archbio.miami.edu/core/misc/ajax.js?v=11.4.5:804 Ajax https://archbio.miami.edu/core/misc/ajax.js?v=11.4.5:651

    R:
    The error you are seeing is a known, major bug caused by upgrading to Drupal 11.4+ while using the views_field_view contributed module. [1, 2]
    🚨 The Root Cause
    In Drupal core version 11.4.0, the internal procedural function views_ui_build_form_url() was completely deprecated and removed. Core replaced it with an object-oriented method: buildFormUrl() via the ViewsFormHelperTrait. [1, 2]
    Because your version of the views_field_view module still tries to call that deleted core function on line 120 of View.php, the backend crashes with a 500 Fatal Error every time you click to configure your global view field (view_2) inside the people_details view layout. [1]

    🛠️ How to Fix It
    Option A: Apply the Drupal Patch (Recommended)
    This is an active major issue in the community (Drupal.org Issue #3610512). If you use Composer to manage your project, you can patch it automatically: [1]
      1. Open your project’s root composer.json file.
      2. Ensure you have the cweagans/composer-patches plugin installed.
      3. Add the patch to your extra section:
        json
        "extra": {
            "composer-patches": {
                "drupal/views_field_view": {
                    "Fix Drupal 11.4 views_ui_build_form_url removal": "https://drupal.org"
                }
            }
        }
        
        Use code with caution.

        (Note: If a consolidated .patch file isn’t directly attached to that issue yet, pull the latest .diff or update to the dev branch 8.x-1.x-dev via Composer).

      4. Run composer update drupal/views_field_view to download and apply the code fix. [1, 2]

    Option B: Temporary Manual Code Fix
    If you need an immediate fix to unlock your administration dashboard right now, you can edit the module file manually.
      1. Open the file on your server:
        /var/www/archbio.miami.edu/html/drupal-11/web/modules/contrib/views_field_view/src/Plugin/views/field/View.php
      2. At the top of the file, make sure the class imports the required Core trait by adding this line alongside the other use statements:
        php
        use Drupal\views\ViewsFormHelperTrait;
        
        Use code with caution.

      3. Inside the class structure itself (usually right after class View extends FieldPluginBase {), incorporate the trait:
        php
        use ViewsFormHelperTrait;
        
        Use code with caution.

      4. Find line 120 where views_ui_build_form_url($form_state) is called, and swap it to use the new object method instead:
        php
        // Change this:
        'url' => views_ui_build_form_url($form_state),
        
        // To this:
        'url' => $this->buildFormUrl($form_state),
        
        Use code with caution.

      5. Clear your Drupal cache via the performance interface or by running drush cr via terminal for the fix to take effect. []

    Let me know if you run into any syntax errors while editing View.php, or if you need the exact syntax to implement the Composer patches configuration for your specific environment!

    Thanks, option A did not work but Option B did

    R:

    I am glad to hear that Option B unblocked you and got your Views interface working again!
    The reason Option A likely failed is that the views_field_view module’s codebase on your server didn’t perfectly match the line numbers or structure expected by that specific community patch file, causing a git conflict during the patch attempt.
    Since you modified the module file directly, keep one important thing in mind: do not run composer update on this module until an official new release (like a 2.0.1 or 8.x-1.2) is published by the maintainers. If you update it via Composer right now, your manual changes will be overwritten, and the 500 crash will return.
    Once the module maintainers commit this fix to their stable release, you can safely update via Composer, and your temporary manual fix will be cleanly replaced by their official code.
    Are there any other views or modules giving you AJAX errors since your upgrade to Drupal 11.4, or is everything else on the site running smoothly now?
    ——————————————————————–