Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attempt to read property "columns" on null when uninstalling #345

Closed
shifuma opened this issue Feb 24, 2023 · 3 comments
Closed

Attempt to read property "columns" on null when uninstalling #345

shifuma opened this issue Feb 24, 2023 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@shifuma
Copy link

shifuma commented Feb 24, 2023

Description

When I try to uninstall the plugin, I get the error: Attempt to read property "columns" on null
It seems to be an issue with the Matrix fields that are created maybe?

This renders the plugin completely unusable, as some of the tables were removed before the error, and now I get:

SQLSTATE[42S02]: Base table or view not found: 1146 Table 'db.enupalstripe_orders' doesn't exist
The SQL being executed was: SELECT DISTINCT(currency) currency from `enupalstripe_orders`

Steps to reproduce

  1. Go to Settings > Plugins
  2. Try to uninstall Stripe Payments

Additional info

Here's the stack trace:

2023-02-24 07:51:09 [web.ERROR] [yii\base\ErrorException:2] yii\base\ErrorException: Attempt to read property "columns" on null in /var/www/html/vendor/craftcms/cms/src/services/Fields.php:1032
Stack trace:
#0 /var/www/html/vendor/craftcms/cms/src/web/ErrorHandler.php(79): yii\base\ErrorHandler->handleError(2, 'Attempt to read...', '/var/www/html/v...', 1032)
#1 /var/www/html/vendor/craftcms/cms/src/services/Fields.php(1032): craft\web\ErrorHandler->handleError(2, 'Attempt to read...', '/var/www/html/v...', 1032)
#2 /var/www/html/vendor/craftcms/cms/src/services/Fields.php(979): craft\services\Fields->_dropOldFieldColumns('selectPlan', 'cddqdfvl')
#3 /var/www/html/vendor/craftcms/cms/src/services/Fields.php(932): craft\services\Fields->applyFieldDelete('c812aa53-8b49-4...')
#4 /var/www/html/vendor/craftcms/cms/src/services/Matrix.php(432): craft\services\Fields->deleteField(Object(craft\fields\Dropdown))
#5 /var/www/html/vendor/craftcms/cms/src/base/ApplicationTrait.php(1698): craft\services\Matrix->handleDeletedBlockType(Object(craft\events\ConfigEvent))
#6 /var/www/html/vendor/craftcms/cms/src/services/ProjectConfig.php(1125): craft\web\Application->craft\base\{closure}(Object(craft\events\ConfigEvent))
#7 [internal function]: craft\services\ProjectConfig->handleChangeEvent(Object(craft\events\ConfigEvent))
#8 /var/www/html/vendor/yiisoft/yii2/base/Component.php(633): call_user_func(Array, Object(craft\events\ConfigEvent))
#9 /var/www/html/vendor/craftcms/cms/src/models/ProjectConfigData.php(76): yii\base\Component->trigger('removeItem', Object(craft\events\ConfigEvent))
#10 /var/www/html/vendor/craftcms/cms/src/services/ProjectConfig.php(515): craft\models\ProjectConfigData->commitChanges(Array, NULL, 'matrixBlockType...', true, 'Delete matrix b...', true)
#11 /var/www/html/vendor/craftcms/cms/src/services/ProjectConfig.php(475): craft\services\ProjectConfig->_setInternal('matrixBlockType...', NULL, 'Delete matrix b...', true, false)
#12 /var/www/html/vendor/craftcms/cms/src/services/ProjectConfig.php(532): craft\services\ProjectConfig->set('matrixBlockType...', NULL, 'Delete matrix b...')
#13 /var/www/html/vendor/craftcms/cms/src/services/Matrix.php(370): craft\services\ProjectConfig->remove('matrixBlockType...', 'Delete matrix b...')
#14 /var/www/html/vendor/craftcms/cms/src/services/Matrix.php(626): craft\services\Matrix->deleteBlockType(Object(craft\models\MatrixBlockType))
#15 /var/www/html/vendor/craftcms/cms/src/fields/Matrix.php(1042): craft\services\Matrix->deleteMatrixField(Object(craft\fields\Matrix))
#16 /var/www/html/vendor/craftcms/cms/src/services/Fields.php(976): craft\fields\Matrix->beforeApplyDelete()
#17 /var/www/html/vendor/craftcms/cms/src/services/Fields.php(932): craft\services\Fields->applyFieldDelete('5bf9ecf7-3339-4...')
#18 /var/www/html/vendor/craftcms/cms/src/services/Fields.php(906): craft\services\Fields->deleteField(Object(craft\fields\Matrix))
#19 /var/www/html/vendor/enupal/stripe/src/services/PaymentForms.php(848): craft\services\Fields->deleteFieldById(225)
#20 /var/www/html/vendor/enupal/stripe/src/Stripe.php(217): enupal\stripe\services\PaymentForms->deleteVariantFields()
#21 /var/www/html/vendor/craftcms/cms/src/base/Plugin.php(168): enupal\stripe\Stripe->afterUninstall()
#22 /var/www/html/vendor/craftcms/cms/src/services/Plugins.php(621): craft\base\Plugin->uninstall()
#23 /var/www/html/vendor/craftcms/cms/src/controllers/PluginsController.php(79): craft\services\Plugins->uninstallPlugin('enupal-stripe')
#24 [internal function]: craft\controllers\PluginsController->actionUninstallPlugin()
#25 /var/www/html/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#26 /var/www/html/vendor/yiisoft/yii2/base/Controller.php(178): yii\base\InlineAction->runWithParams(Array)
#27 /var/www/html/vendor/yiisoft/yii2/base/Module.php(552): yii\base\Controller->runAction('uninstall-plugi...', Array)
#28 /var/www/html/vendor/craftcms/cms/src/web/Application.php(301): yii\base\Module->runAction('plugins/uninsta...', Array)
#29 /var/www/html/vendor/craftcms/cms/src/web/Application.php(625): craft\web\Application->runAction('plugins/uninsta...', Array)
#30 /var/www/html/vendor/craftcms/cms/src/web/Application.php(280): craft\web\Application->_processActionRequest(Object(craft\web\Request))
#31 /var/www/html/vendor/yiisoft/yii2/base/Application.php(384): craft\web\Application->handleRequest(Object(craft\web\Request))
#32 /var/www/html/web/index.php(12): yii\base\Application->run()
#33 {main} {"memory":8686720,"exception":"[object] (yii\\base\\ErrorException(code: 2): Attempt to read property \"columns\" on null at /var/www/html/vendor/craftcms/cms/src/services/Fields.php:1032)"} 
2023-02-24 07:51:09 [web.INFO] [application] Request context:
  • Craft version: 4.3.10
  • PHP version: 8.1
  • Database driver & version: MySQL 5.7
  • Plugin version: 5.1.0
  • Is SCA and Stripe Checkout enabled?: Yes
@shifuma
Copy link
Author

shifuma commented Feb 24, 2023

Same error happens when trying to manually delete the YAML and reapply project config. This is trying to remove the checkbox matrix block type:

removing matrixBlockTypes.0eab815e-bf09-4502-ab69-e2f2417e0912 ...
error: Attempt to read property "columns" on null

@shifuma
Copy link
Author

shifuma commented Feb 24, 2023

Restoring from a backup, it seems I somehow have 4 versions of each of the field types. But I'm struggling to get rid of them.

@andrelopez andrelopez self-assigned this Feb 24, 2023
andrelopez added a commit that referenced this issue Jul 29, 2023
@andrelopez
Copy link
Member

Hi @shifuma About your last two messages I was able to recreate this issue. Please update your plugin to v5.2.0 now your changes will be propagated to your prod envs. Please let me know if you still have issues.

@andrelopez andrelopez added bug Something isn't working and removed need more info labels Jul 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants