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

Exception when saving user #5

Closed
jmauzyk opened this issue Apr 23, 2019 · 3 comments
Closed

Exception when saving user #5

jmauzyk opened this issue Apr 23, 2019 · 3 comments

Comments

@jmauzyk
Copy link
Contributor

jmauzyk commented Apr 23, 2019

Throwing an exception when attempting to save user preferences in the Control Panel. Not saving any address info but it appears to be triggering the onBeforeSaveAddress event. Stack trace:

yii\base\Exception: Invalid address. in /Users/joel/Sites/craft3/vendor/surprisehighway/craft-avatax/src/services/SalesTaxService.php:380
Stack trace:
#0 /Users/joel/Sites/craft3/vendor/surprisehighway/craft-avatax/src/Avatax.php(176): surprisehighway\avatax\services\SalesTaxService->validateAddress(Object(craft\commerce\models\Address))
#1 /Users/joel/Sites/craft3/vendor/surprisehighway/craft-avatax/src/Avatax.php(131): surprisehighway\avatax\Avatax->onBeforeSaveAddress(Object(craft\commerce\events\AddressEvent))
#2 [internal function]: surprisehighway\avatax\Avatax->surprisehighway\avatax\{closure}(Object(craft\commerce\events\AddressEvent))
#3 /Users/joel/Sites/craft3/vendor/yiisoft/yii2/base/Event.php(312): call_user_func(Object(Closure), Object(craft\commerce\events\AddressEvent))
#4 /Users/joel/Sites/craft3/vendor/yiisoft/yii2/base/Component.php(636): yii\base\Event::trigger('craft\\commerce\\...', 'beforeSaveAddre...', Object(craft\commerce\events\AddressEvent))
#5 /Users/joel/Sites/craft3/vendor/craftcms/commerce/src/services/Addresses.php(200): yii\base\Component->trigger('beforeSaveAddre...', Object(craft\commerce\events\AddressEvent))
#6 /Users/joel/Sites/craft3/vendor/craftcms/commerce/src/elements/Order.php(927): craft\commerce\services\Addresses->saveAddress(Object(craft\commerce\models\Address), false)
#7 /Users/joel/Sites/craft3/vendor/craftcms/cms/src/services/Elements.php(515): craft\commerce\elements\Order->afterSave(false)
#8 /Users/joel/Sites/craft3/vendor/craftcms/commerce/src/services/Customers.php(426): craft\services\Elements->saveElement(Object(craft\commerce\elements\Order))
#9 [internal function]: craft\commerce\services\Customers->saveUserHandler(Object(craft\events\ModelEvent))
#10 /Users/joel/Sites/craft3/vendor/yiisoft/yii2/base/Event.php(312): call_user_func(Array, Object(craft\events\ModelEvent))
#11 /Users/joel/Sites/craft3/vendor/yiisoft/yii2/base/Component.php(636): yii\base\Event::trigger('craft\\elements\\...', 'afterSave', Object(craft\events\ModelEvent))
#12 /Users/joel/Sites/craft3/vendor/craftcms/cms/src/base/Element.php(1889): yii\base\Component->trigger('afterSave', Object(craft\events\ModelEvent))
#13 /Users/joel/Sites/craft3/vendor/craftcms/cms/src/elements/User.php(1322): craft\base\Element->afterSave(false)
#14 /Users/joel/Sites/craft3/vendor/craftcms/cms/src/services/Elements.php(515): craft\elements\User->afterSave(false)
#15 /Users/joel/Sites/craft3/vendor/craftcms/cms/src/controllers/UsersController.php(1088): craft\services\Elements->saveElement(Object(craft\elements\User), false)
#16 [internal function]: craft\controllers\UsersController->actionSaveUser()
#17 /Users/joel/Sites/craft3/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#18 /Users/joel/Sites/craft3/vendor/yiisoft/yii2/base/Controller.php(157): yii\base\InlineAction->runWithParams(Array)
#19 /Users/joel/Sites/craft3/vendor/craftcms/cms/src/web/Controller.php(109): yii\base\Controller->runAction('save-user', Array)
#20 /Users/joel/Sites/craft3/vendor/yiisoft/yii2/base/Module.php(528): craft\web\Controller->runAction('save-user', Array)
#21 /Users/joel/Sites/craft3/vendor/craftcms/cms/src/web/Application.php(297): yii\base\Module->runAction('users/save-user', Array)
#22 /Users/joel/Sites/craft3/vendor/craftcms/cms/src/web/Application.php(561): craft\web\Application->runAction('users/save-user', Array)
#23 /Users/joel/Sites/craft3/vendor/craftcms/cms/src/web/Application.php(281): craft\web\Application->_processActionRequest(Object(craft\web\Request))
#24 /Users/joel/Sites/craft3/vendor/yiisoft/yii2/base/Application.php(386): craft\web\Application->handleRequest(Object(craft\web\Request))
#25 /Users/joel/Sites/craft3/web/index.php(21): yii\base\Application->run()
#26 {main}
@jmauzyk
Copy link
Contributor Author

jmauzyk commented Apr 24, 2019

To clarify, this exception happens in the Control Panel when saving updates to an existing user who already has addresses associated with their account. Does not happen when saving new users.

@imagehat
Copy link
Collaborator

Thanks @jmauzyk - to get around this for now you should be able to disable address validation in the Avatax plugin settings. But yeah that address check should probably only happen during the front-end checkout flow so I'll see what we need to change.

@imagehat
Copy link
Collaborator

imagehat commented Sep 3, 2019

This was fixed with v2.0.3.

@imagehat imagehat closed this as completed Sep 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants