Error: Call to a member function getId() on null in Drupal\commerce_payment\Plugin\Commerce\CheckoutPane\PaymentInformation->buildPaneForm()

Created on 4 October 2021, about 3 years ago
Updated 9 October 2024, 3 months ago

The rest of the website at the moment seems ok but I'm not sure why but when going to checkout on my site I get the following below. Please if anyone can help it would be much appreciated.

( a bit of background - I have upgraded core from 8.9.19 to 9.2.6 and commerce from 2.23 to 2.27 among other modules. I have another site that I did something similar but there is no problem with checkout).

The website encountered an unexpected error. Please try again later.
Error: Call to a member function getId() on null in Drupal\commerce_payment\Plugin\Commerce\CheckoutPane\PaymentInformation->buildPaneForm() (line 195 of modules/contrib/commerce/modules/payment/src/Plugin/Commerce/CheckoutPane/PaymentInformation.php).

Drupal\commerce_payment\Plugin\Commerce\CheckoutPane\PaymentInformation->buildPaneForm(Array, Object, Array) (Line: 546)
Drupal\commerce_checkout\Plugin\Commerce\CheckoutFlow\CheckoutFlowWithPanesBase->buildForm(Array, Object, 'order_information')
call_user_func_array(Array, Array) (Line: 532)
Drupal\Core\Form\FormBuilder->retrieveForm('commerce_checkout_flow_multistep_default', Object) (Line: 278)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 219)
Drupal\Core\Form\FormBuilder->getForm(Object, 'order_information') (Line: 143)
Drupal\commerce_checkout\Controller\CheckoutController->formPage(Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 578)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 158)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 80)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 52)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 717)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

🐛 Bug report
Status

Closed: works as designed

Version

2.27

Component

Checkout

Created by

🇬🇧United Kingdom mnsmithuk

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • @mnsmithuk
    Thanks so much for posting your experience with the failing migration:import.
    I was having this exact issue after running the initial migration, then making changes different elements of the shop and then trying to run the upgrade_uc7_payment migration with --update flag (failing to import all the new payments for orders).
    The issue ended up being a change to the Payment Processors.
    To resolve it

    • I rolled back the payment processors migration job
    • Cleared all the caches
    • Re-ran the payment processor migration
    • Edited each payment processor entry created and saved the node
    • After saving all the nodes re-ran the payments job

    Some config is changed the first time you save the node that allows the migration to 'find' it now.
    This got it working again and got the D10 unblocked.

    Hope this helps someone facing the same issue.

Production build 0.71.5 2024