"The user specified as a definer does not exist" error thrown on node save

Created on 21 February 2024, about 1 year ago

When saving a node that has links, Link Checker throws this fatal error:

Drupal\Core\Entity\EntityStorageException: SQLSTATE[HY000]: General error: 1449 The user specified as a definer ('80fbdcbc7ebb4170a8b030abea458d84'@'%') does not exist: INSERT INTO "linkchecker_link" ("status", "urlhash", "url", "method", "code", "error", "fail_count", "last_check", "entity_id__target_id", "entity_id__target_type", "entity_field", "entity_langcode") VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7, :db_insert_placeholder_8, :db_insert_placeholder_9, :db_insert_placeholder_10, :db_insert_placeholder_11); Array ( [:db_insert_placeholder_0] => 1 [:db_insert_placeholder_1] => GMlyZYFqvNqAqHZiF4gfiK3oFiXblFaIovgrb_Ga90Y [:db_insert_placeholder_2] => https://my-site.com/my/page/path/winscp [:db_insert_placeholder_3] => HEAD [:db_insert_placeholder_4] => [:db_insert_placeholder_5] => [:db_insert_placeholder_6] => 0 [:db_insert_placeholder_7] => [:db_insert_placeholder_8] => 1352 [:db_insert_placeholder_9] => node [:db_insert_placeholder_10] => body [:db_insert_placeholder_11] => en ) in Drupal\Core\Entity\Sql\SqlContentEntityStorage->save() (line 817 of /code/web/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php).

Here's the backtrace:

#0 /code/web/core/lib/Drupal/Core/Entity/EntityBase.php(352): Drupal\Core\Entity\Sql\SqlContentEntityStorage->save(Object(Drupal\node\Entity\Node))
#1 /code/web/core/modules/node/src/NodeForm.php(270): Drupal\Core\Entity\EntityBase->save()
#2 [internal function]: Drupal\node\NodeForm->save(Array, Object(Drupal\Core\Form\FormState))
#3 /code/web/core/lib/Drupal/Core/Form/FormSubmitter.php(129): call_user_func_array(Array, Array)
#4 /code/web/core/lib/Drupal/Core/Form/FormSubmitter.php(67): Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object(Drupal\Core\Form\FormState))
#5 /code/web/core/lib/Drupal/Core/Form/FormBuilder.php(597): Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object(Drupal\Core\Form\FormState))
#6 /code/web/core/lib/Drupal/Core/Form/FormBuilder.php(325): Drupal\Core\Form\FormBuilder->processForm('node_lit_page_e...', Array, Object(Drupal\Core\Form\FormState))
#7 /code/web/core/lib/Drupal/Core/Controller/FormController.php(73): Drupal\Core\Form\FormBuilder->buildForm(Object(Drupal\node\NodeForm), Object(Drupal\Core\Form\FormState))
#8 /code/web/core/modules/layout_builder/src/Controller/LayoutBuilderHtmlEntityFormController.php(39): Drupal\Core\Controller\FormController->getContentResult(Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Routing\RouteMatch))
#9 [internal function]: Drupal\layout_builder\Controller\LayoutBuilderHtmlEntityFormController->getContentResult(Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Routing\RouteMatch))
#10 /code/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array)
#11 /code/web/core/lib/Drupal/Core/Render/Renderer.php(627): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#12 /code/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure))
#13 /code/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array)
#14 /code/vendor/symfony/http-kernel/HttpKernel.php(181): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#15 /code/vendor/symfony/http-kernel/HttpKernel.php(76): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1)
#16 /code/web/core/lib/Drupal/Core/StackMiddleware/Session.php(58): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#17 /code/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#18 /code/web/core/lib/Drupal/Core/StackMiddleware/ContentLength.php(28): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#19 /code/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\Core\StackMiddleware\ContentLength->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#20 /code/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#21 /code/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#22 /code/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#23 /code/web/core/lib/Drupal/Core/StackMiddleware/AjaxPageState.php(36): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#24 /code/web/core/lib/Drupal/Core/StackMiddleware/StackedHttpKernel.php(51): Drupal\Core\StackMiddleware\AjaxPageState->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#25 /code/web/core/lib/Drupal/Core/DrupalKernel.php(704): Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#26 /code/web/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request))
#27 {main}
πŸ› Bug report
Status

Active

Version

2.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States joakland

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @joakland
  • Status changed to Postponed: needs info about 1 year ago
  • πŸ‡³πŸ‡΄Norway eiriksm Norway

    This module has automated tests saving nodes with links, and the wording of the error you posted very much seems like it comes from another module.

    So if you could reproduce this on a clean install of Drupal and link checker and report back from there, that would be a good place to start πŸ€“βœŒοΈ

  • πŸ‡ΊπŸ‡ΈUnited States mwebaze

    I am facing the same issue on one of our sites. Saving a linkcheckerlink entity is throwing this exception in saveLink in LinkExtractorService. Catching this exception does prevent causing "white screen" but the links aren't saved.

  • The same error in our site when the URL is an external link.

  • πŸ‡ΊπŸ‡ΈUnited States trevjs

    Was there a previous version of the module that introduced database triggers? I was able to get past the error by running the following queries:

    DROP TRIGGER [database].linkchecker_link_der_update;
    DROP TRIGGER [database].linkchecker_link_der_insert;
    

    Replace [database] with the name of your database.

    My assumption is that these are safe to remove since there aren't being created by the current version of the module

  • πŸ‡ΊπŸ‡ΈUnited States jcontreras

    @trevjs - I came across this issue on my setup. Your suggestion worked so I created a custom module to run an update and do this for my local and live setup so I don't encounter this issue.

    /**
     * Drops the linkchecker triggers if they exist.
     */
    function custom_module_update_8001() {
      $database = \Drupal::database();
    
      // List of triggers to drop.
      $triggers = [
        'linkchecker_link_der_update',
        'linkchecker_link_der_insert',
      ];
    
      foreach ($triggers as $trigger) {
        try {
          $database->query("DROP TRIGGER IF EXISTS {$trigger};");
          \Drupal::logger('custom_module')->notice("Dropped trigger: {$trigger}");
        } catch (\Exception $e) {
          \Drupal::logger('custom_module')->error("Failed to drop trigger {$trigger}: " . $e->getMessage());
        }
      }
    }
    
Production build 0.71.5 2024