Project60 / org.project60.sepa

SEPA direct debit integration with civicrm
19 stars 46 forks source link

Error on update database when upgrading to version 1.9.0 #680

Closed tobiberlin closed 1 year ago

tobiberlin commented 1 year ago

When I run the db update an error "DB Error: already exists" appears. In Drupal's watchdog the error appears after an entry

CustomDataHelper (org.project60.sepa): CREATE OptionValue: {"label":"SDD - CBIBdySDDReq.00.01.00","name":"CBIBdySDDReq_00_01_00","filter":"0","is_reserved":"1","is_active":"1","option_group_id":"126"}

Here is the full call stack found in watchdog:

$CRM_Queue_Page_AJAX_runNext_error = CRM_Core_Exception: "DB Error: already exists" 

#0 C:\wamp64\www\civicrm\httpdocs\sites\default\files\civicrm\ext\org.project60.sepa\CRM\Sepa\CustomData.php(266): civicrm_api3("OptionValue", "create", (Array:7)) 
#1 C:\wamp64\www\civicrm\httpdocs\sites\default\files\civicrm\ext\org.project60.sepa\CRM\Sepa\CustomData.php(109): CRM_Sepa_CustomData->createEntity("OptionValue", (Array:6)) 
#2 C:\wamp64\www\civicrm\httpdocs\sites\default\files\civicrm\ext\org.project60.sepa\CRM\Sepa\Upgrader.php(493): CRM_Sepa_CustomData->syncOptionGroup("C:\wamp64\www\civicrm\httpdocs\sites\default\files\civicrm\ext\org.project60....") 
#3 C:\wamp64\www\civicrm\httpdocs\sites\default\files\civicrm\ext\org.project60.sepa\CRM\Sepa\Upgrader\Base.php(74): CRM_Sepa_Upgrader->upgrade_1803() 
#4 C:\wamp64\www\civicrm\vendor\civicrm\civicrm-core\CRM\Queue\Task.php(101): CRM_Sepa_Upgrader_Base::_queueAdapter(Object(CRM_Queue_TaskContext), "upgrade_1803") 
#5 C:\wamp64\www\civicrm\vendor\civicrm\civicrm-core\CRM\Queue\Runner.php(255): CRM_Queue_Task->run(Object(CRM_Queue_TaskContext)) 
#6 C:\wamp64\www\civicrm\vendor\civicrm\civicrm-core\CRM\Queue\Page\AJAX.php(36): CRM_Queue_Runner->runNext(TRUE) 
#7 C:\wamp64\www\civicrm\vendor\civicrm\civicrm-core\CRM\Queue\ErrorPolicy.php(89): CRM_Queue_Page_AJAX::{closure}() 
#8 C:\wamp64\www\civicrm\vendor\civicrm\civicrm-core\CRM\Queue\Page\AJAX.php(38): CRM_Queue_ErrorPolicy->call(Object(Closure)) 
#9 C:\wamp64\www\civicrm\vendor\civicrm\civicrm-core\CRM\Core\Invoke.php(285): CRM_Queue_Page_AJAX::runNext() 
#10 C:\wamp64\www\civicrm\vendor\civicrm\civicrm-core\CRM\Core\Invoke.php(69): CRM_Core_Invoke::runItem((Array:17)) 
#11 C:\wamp64\www\civicrm\vendor\civicrm\civicrm-core\CRM\Core\Invoke.php(36): CRM_Core_Invoke::_invoke((Array:4)) 
#12 C:\wamp64\www\civicrm\httpdocs\modules\contrib\civicrm\src\Civicrm.php(88): CRM_Core_Invoke::invoke((Array:4)) 
#13 C:\wamp64\www\civicrm\httpdocs\modules\contrib\civicrm\src\Controller\CivicrmController.php(83): Drupal\civicrm\Civicrm->invoke((Array:4)) 
#14 [internal function](): Drupal\civicrm\Controller\CivicrmController->main((Array:4), "queue:ajax:runNext") 
#15 C:\wamp64\www\civicrm\httpdocs\core\lib\Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array((Array:2), (Array:2)) 
#16 C:\wamp64\www\civicrm\httpdocs\core\lib\Drupal\Core\Render\Renderer.php(580): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() 
#17 C:\wamp64\www\civicrm\httpdocs\core\lib\Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure)) 
#18 C:\wamp64\www\civicrm\httpdocs\core\lib\Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext((Array:2), (Array:2)) 
#19 C:\wamp64\www\civicrm\vendor\symfony\http-kernel\HttpKernel.php(169): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() 
#20 C:\wamp64\www\civicrm\vendor\symfony\http-kernel\HttpKernel.php(81): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1) 
#21 C:\wamp64\www\civicrm\httpdocs\core\lib\Drupal\Core\StackMiddleware\Session.php(58): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, TRUE) 
#22 C:\wamp64\www\civicrm\httpdocs\core\lib\Drupal\Core\StackMiddleware\KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, TRUE) 
#23 C:\wamp64\www\civicrm\httpdocs\core\modules\page_cache\src\StackMiddleware\PageCache.php(106): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, TRUE) 
#24 C:\wamp64\www\civicrm\httpdocs\core\modules\page_cache\src\StackMiddleware\PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, TRUE) 
#25 C:\wamp64\www\civicrm\httpdocs\core\lib\Drupal\Core\StackMiddleware\ReverseProxyMiddleware.php(48): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, TRUE) 
#26 C:\wamp64\www\civicrm\httpdocs\core\lib\Drupal\Core\StackMiddleware\NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, TRUE) 
#27 C:\wamp64\www\civicrm\vendor\stack\builder\src\Stack\StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, TRUE) 
#28 C:\wamp64\www\civicrm\httpdocs\core\lib\Drupal\Core\DrupalKernel.php(718): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, TRUE) 
#29 C:\wamp64\www\civicrm\httpdocs\index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request)) 
#30 {main}
bjendres commented 1 year ago

@tobiberlin Hm interesting. Could you post the entire content of the OptionGroup 126? There shouldn't be any sensitive information in there...

bjendres commented 1 year ago

The issue is probably related to #601

tobiberlin commented 1 year ago

Here is the optiongroup @bjendres

Screenshot 2023-08-15 100016

pminf commented 1 year ago

This issue blocks the update to version 1.9.0, which we need to install in order to be compatible with CiviCRM 60.x (#670). Could you please take a closer look at this error, @bjendres?

bjendres commented 1 year ago

Hi @tobiberlin and @pminf, thanks for reporting. I think I found the mistake - an inconsistency in lookup, see https://github.com/Project60/org.project60.sepa/commit/865b9de207e5a37eba0e38e9d0b03f80866146a4.

Could either of you verify that the attached version works for you? If it works, I'll release a 1.9.1 right away.

pminf commented 1 year ago

@bjendres, yes, it does solve our update issue. It seems to work for us. Thank you!

bjendres commented 1 year ago

Released with 1.9.1