craftcms / commerce-stripe

Stripe payment gateway for Craft Commerce
https://plugins.craftcms.com/commerce-stripe
MIT License
31 stars 48 forks source link

500 error - Gateway non-object error #101

Closed SamHoltby closed 3 years ago

SamHoltby commented 4 years ago

Description

While logged in the website is returning 500 response on random occusions . See error message from web.log below.

It looks to be related to the Commerce Stripe Gateway.php class.

Steps to reproduce

  1. Use the site while logged in.

Additional info

PHP | 7.2.6 Craft Pro | 3.2.7 Craft Commerce | 2.1.9 Stripe for Craft Commerce | 2.0.1.2

Error: `2020-02-19 06:31:24 [-][1783][h61kv305tu10n9bd87catp9903][error][yii\base\ErrorException:8] yii\base\ErrorException: Trying to get property of non-object in public_html/craftbuild/craft/vendor/craftcms/commerce-stripe/src/base/Gateway.php:104 Stack trace:

0 public_html/craftbuild/craft/vendor/craftcms/cms/src/web/ErrorHandler.php(81): yii\base\ErrorHandler->handleError(8, 'Trying to get p...', '/home/248738.cl...', 104)

1 public_html/craftbuild/craft/vendor/craftcms/commerce-stripe/src/base/Gateway.php(104): craft\web\ErrorHandler->handleError(8, 'Trying to get p...', '/home/248738.cl...', 104, Array)

2 public_html/craftbuild/craft/vendor/yiisoft/yii2/base/BaseObject.php(109): craft\commerce\stripe\base\Gateway->init()

3 public_html/craftbuild/craft/vendor/craftcms/cms/src/helpers/Component.php(112): yii\base\BaseObject->__construct(Array)

4 public_html/craftbuild/craft/vendor/craftcms/commerce/src/services/Gateways.php(386): craft\helpers\Component::createComponent(Array, 'craft\commerce\...')

5 public_html/craftbuild/craft/vendor/craftcms/commerce/src/services/Gateways.php(122): craft\commerce\services\Gateways->createGateway(Array)

6 public_html/craftbuild/craft/vendor/craftcms/commerce/src/elements/Order.php(432): craft\commerce\services\Gateways->getAllCustomerEnabledGateways()

7 public_html/craftbuild/craft/vendor/yiisoft/yii2/base/Model.php(350): craft\commerce\elements\Order->beforeValidate()

8 public_html/craftbuild/craft/vendor/craftcms/cms/src/services/Elements.php(536): yii\base\Model->validate()

9 public_html/craftbuild/craft/vendor/craftcms/commerce/src/helpers/Order.php(79): craft\services\Elements->saveElement(Object(craft\commerce\elements\Order))

10 public_html/craftbuild/craft/vendor/craftcms/commerce/src/services/Customers.php(273): craft\commerce\helpers\Order::mergeOrders(Object(craft\commerce\elements\Order), Object(craft\commerce\elements\Order))

11 [internal function]: craft\commerce\services\Customers->loginHandler(Object(yii\web\UserEvent))

12 public_html/craftbuild/craft/vendor/yiisoft/yii2/base/Event.php(312): call_user_func(Array, Object(yii\web\UserEvent))

13 public_html/craftbuild/craft/vendor/yiisoft/yii2/base/Component.php(636): yii\base\Event::trigger('yii\web\User', 'afterLogin', Object(yii\web\UserEvent))

14 public_html/craftbuild/craft/vendor/yiisoft/yii2/web/User.php(495): yii\base\Component->trigger('afterLogin', Object(yii\web\UserEvent))

15 public_html/craftbuild/craft/vendor/craftcms/cms/src/web/User.php(422): yii\web\User->afterLogin(Object(craft\elements\User), true, 1209600)

16 public_html/craftbuild/craft/vendor/yiisoft/yii2/web/User.php(323): craft\web\User->afterLogin(Object(craft\elements\User), true, 1209600)

17 public_html/craftbuild/craft/vendor/yiisoft/yii2/web/User.php(707): yii\web\User->loginByCookie()

18 public_html/craftbuild/craft/vendor/craftcms/cms/src/web/User.php(485): yii\web\User->renewAuthStatus()

19 public_html/craftbuild/craft/vendor/yiisoft/yii2/web/User.php(192): craft\web\User->renewAuthStatus()

20 public_html/craftbuild/craft/vendor/craftcms/cms/src/web/User.php(231): yii\web\User->getIdentity()

21 public_html/craftbuild/craft/vendor/mmikkel/cp-field-inspect/src/CpFieldInspect.php(76): craft\web\User->getIsAdmin()

22 public_html/craftbuild/craft/vendor/yiisoft/yii2/base/BaseObject.php(109): mmikkel\cpfieldinspect\CpFieldInspect->init()

23 public_html/craftbuild/craft/vendor/yiisoft/yii2/base/Module.php(158): yii\base\BaseObject->__construct(Array)

24 public_html/craftbuild/craft/vendor/craftcms/cms/src/base/Plugin.php(127): yii\base\Module->__construct('cp-field-inspec...', Object(craft\web\Application), Array)

25 [internal function]: craft\base\Plugin->__construct('cp-field-inspec...', Object(craft\web\Application), Array)

26 public_html/craftbuild/craft/vendor/yiisoft/yii2/di/Container.php(384): ReflectionClass->newInstanceArgs(Array)

27 public_html/craftbuild/craft/vendor/yiisoft/yii2/di/Container.php(156): yii\di\Container->build('mmikkel\cpfield...', Array, Array)

28 public_html/craftbuild/craft/vendor/yiisoft/yii2/BaseYii.php(349): yii\di\Container->get('mmikkel\cpfield...', Array, Array)

29 public_html/craftbuild/craft/vendor/craftcms/cms/src/services/Plugins.php(897): yii\BaseYii::createObject(Array, Array)

30 public_html/craftbuild/craft/vendor/craftcms/cms/src/services/Plugins.php(230): craft\services\Plugins->createPlugin('cp-field-inspec...', Array)

31 public_html/craftbuild/craft/vendor/craftcms/cms/src/base/ApplicationTrait.php(1323): craft\services\Plugins->loadPlugins()

32 public_html/craftbuild/craft/vendor/craftcms/cms/src/web/Application.php(112): craft\web\Application->_postInit()

33 public_html/craftbuild/craft/vendor/yiisoft/yii2/base/BaseObject.php(109): craft\web\Application->init()

34 public_html/craftbuild/craft/vendor/yiisoft/yii2/base/Application.php(206): yii\base\BaseObject->__construct(Array)

35 public_html/craftbuild/craft/vendor/craftcms/cms/src/web/Application.php(100): yii\base\Application->__construct(Array)

36 [internal function]: craft\web\Application->__construct(Array)

37 public_html/craftbuild/craft/vendor/yiisoft/yii2/di/Container.php(384): ReflectionClass->newInstanceArgs(Array)

38 public_html/craftbuild/craft/vendor/yiisoft/yii2/di/Container.php(156): yii\di\Container->build('craft\web\Appli...', Array, Array)

39 public_html/craftbuild/craft/vendor/yiisoft/yii2/BaseYii.php(349): yii\di\Container->get('craft\web\Appli...', Array, Array)

40 public_html/craftbuild/craft/vendor/craftcms/cms/bootstrap/bootstrap.php(248): yii\BaseYii::createObject(Array)

41 public_html/craftbuild/craft/vendor/craftcms/cms/bootstrap/web.php(52): require('/home/248738.cl...')

42 public_html/craftbuild/craft/web/index.php(22): require('/home/248738.cl...')

43 {main}

2020-02-19 06:31:23 [-][1783][h61kv305tu10n9bd87catp9903][info][application] $_GET = [ 'p' => 'admin/actions/users/get-remaining-session-time' 'dontExtendSession' => '1' ]`

lukeholder commented 3 years ago

Please update to the latest of Craft and Commerce and let us know if the issue persists.