After upgrading module from Drupal 9.5 with Address 8.x-1.11
to Drupal 10.2.3 with Address 2.0.1
I'm getting the following error
Uncaught PHP Exception TypeError: "Cannot assign null to property
CommerceGuys\Addressing\Country\CountryRepository::$defaultLocale of type string"
at /app/web/modules/contrib/address/src/Repository/CountryRepository.php line 37
It crashes on:
- pages with address
- editing address field
- adding new address field
Seems like this is something to do with the uninstalling the following modules:
- Languages [uninstalling this module causes an issue]
- Content translation
Reenabling those modules restores the functionality.
Here's full stacktrace after reenabling language module via drush
[error] TypeError: Cannot assign null to property CommerceGuys\/app/ressing\Country\CountryRepository::$defaultLocale of type string in Drupal\/app/ress\Repository\CountryRepository->__construct() (line 37 of /app/web/modules/contrib//app/ress/src/Repository/CountryRepository.php) #0 /app/web/core/lib/Drupal/Component/DependencyInjection/Container.php(259): Drupal\/app/ress\Repository\CountryRepository->__construct(Object(Drupal\Core\Cache\DatabaseBackend), Object(Drupal\language\ConfigurableLanguageManager))
#1 /app/web/core/lib/Drupal/Component/DependencyInjection/Container.php(177): Drupal\Component\DependencyInjection\Container->createService(Array, '/app/ress.country...')
#2 /app/web/modules/contrib//app/ress/src/Plugin/Field/FieldFormatter//app/ressDefaultFormatter.php(103): Drupal\Component\DependencyInjection\Container->get('/app/ress.country...')
#3 /app/web/core/lib/Drupal/Core/Field/FormatterPluginManager.php(64): Drupal\/app/ress\Plugin\Field\FieldFormatter\/app/ressDefaultFormatter::create(Object(Drupal\Core\DependencyInjection\Container), Array, '/app/ress_default', Array)
#4 /app/web/core/lib/Drupal/Core/Plugin/DefaultLazyPluginCollection.php(81): Drupal\Core\Field\FormatterPluginManager->createInstance('/app/ress_default', Array)
#5 /app/web/core/lib/Drupal/Component/Plugin/LazyPluginCollection.php(80): Drupal\Core\Plugin\DefaultLazyPluginCollection->initializePlugin('/app/ress_default')
#6 /app/web/core/lib/Drupal/Component/Plugin/LazyPluginCollection.php(149): Drupal\Component\Plugin\LazyPluginCollection->get('/app/ress_default')
#7 /app/web/core/lib/Drupal/Core/Plugin/DefaultLazyPluginCollection.php(114): Drupal\Component\Plugin\LazyPluginCollection->getIterator()
#8 /app/web/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php(295): Drupal\Core\Plugin\DefaultLazyPluginCollection->getConfiguration()
#9 /app/web/core/lib/Drupal/Core/Entity/EntityDisplayBase.php(270): Drupal\Core\Config\Entity\ConfigEntityBase->preSave(Object(Drupal\Core\Config\Entity\ConfigEntityStorage))
#10 /app/web/core/lib/Drupal/Core/Entity/EntityStorageBase.php(528): Drupal\Core\Entity\EntityDisplayBase->preSave(Object(Drupal\Core\Config\Entity\ConfigEntityStorage))
#11 /app/web/core/lib/Drupal/Core/Entity/EntityStorageBase.php(483): Drupal\Core\Entity\EntityStorageBase->doPreSave(Object(Drupal\Core\Entity\Entity\EntityViewDisplay))
#12 /app/web/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php(257): Drupal\Core\Entity\EntityStorageBase->save(Object(Drupal\Core\Entity\Entity\EntityViewDisplay))
#13 /app/web/core/lib/Drupal/Core/Entity/EntityBase.php(352): Drupal\Core\Config\Entity\ConfigEntityStorage->save(Object(Drupal\Core\Entity\Entity\EntityViewDisplay))
#14 /app/web/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php(609): Drupal\Core\Entity\EntityBase->save()
#15 /app/web/core/modules/language/language.module(312): Drupal\Core\Config\Entity\ConfigEntityBase->save()
#16 [internal function]: language_modules_installed(Array, false)
#17 /app/web/core/lib/Drupal/Core/Extension/ModuleHandler.php(409): call_user_func_array(Object(Closure), Array)
#18 /app/web/core/lib/Drupal/Core/Extension/ModuleHandler.php(388): Drupal\Core\Extension\ModuleHandler->Drupal\Core\Extension\{closure}(Object(Closure), 'language')
#19 /app/web/core/lib/Drupal/Core/Extension/ModuleHandler.php(408): Drupal\Core\Extension\ModuleHandler->invokeAllWith('modules_install...', Object(Closure))
#20 /app/web/core/lib/Drupal/Core/Extension/ModuleInstaller.php(388): Drupal\Core\Extension\ModuleHandler->invokeAll('modules_install...', Array)
#21 /app/web/core/lib/Drupal/Core/ProxyClass/Extension/ModuleInstaller.php(83): Drupal\Core\Extension\ModuleInstaller->install(Array, true)
#22 /app/vendor/drush/drush/src/Commands/pm/PmCommands.php(102): Drupal\Core\ProxyClass\Extension\ModuleInstaller->install(Array, true)
#23 [internal function]: Drush\Commands\pm\PmCommands->install(Array, Array)
#24 /app/vendor/consolidation/annotated-command/src/CommandProcessor.php(276): call_user_func_array(Array, Array)
#25 /app/vendor/consolidation/annotated-command/src/CommandProcessor.php(212): Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback(Array, Object(Consolidation\AnnotatedCommand\CommandData))
#26 /app/vendor/consolidation/annotated-command/src/CommandProcessor.php(175): Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter(Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))
#27 /app/vendor/consolidation/annotated-command/src/AnnotatedCommand.php(387): Consolidation\AnnotatedCommand\CommandProcessor->process(Object(Symfony\Component\Console\Output\ConsoleOutput), Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))
#28 /app/vendor/symfony/console/Command/Command.php(326): Consolidation\AnnotatedCommand\AnnotatedCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#29 /app/vendor/symfony/console/Application.php(1096): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#30 /app/vendor/symfony/console/Application.php(324): Symfony\Component\Console\Application->doRunCommand(Object(Consolidation\AnnotatedCommand\AnnotatedCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#31 /app/vendor/symfony/console/Application.php(175): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#32 /app/vendor/drush/drush/src/Runtime/Runtime.php(110): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#33 /app/vendor/drush/drush/src/Runtime/Runtime.php(40): Drush\Runtime\Runtime->doRun(Array, Object(Symfony\Component\Console\Output\ConsoleOutput))
#34 /app/vendor/drush/drush/drush.php(139): Drush\Runtime\Runtime->run(Array)
#35 /app/vendor/drush/drush/drush(4): require('/Users/tesboss/...')
#36 /app/vendor/bin/drush(119): include('/Users/tesboss/...')
#37 {main}.