white-nl / commerce-sendcloud

Sendcloud integration for Craft Commerce
Other
5 stars 2 forks source link

Invalid username/password while retrieving shipping methods #11

Closed meintjes22 closed 2 years ago

meintjes22 commented 2 years ago

Description

The plugin seemed to work fine for a while but somehow I allways get the following error message in the ajax view while in the settings:

GuzzleHttp\Exception\ClientException: Client error: `GET https://panel.sendcloud.sc/api/v2/shipping_methods` resulted in a `401 Unauthorized` response:
{"error":{"code":401,"request":"api/v2/shipping_methods","message":"Invalid username/password."}}
 in /var/www/clients/client31/web60/web/shop/testing/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php:113

The plugin connects just fine to sendcloud and also shows as Active in the settings. Shipping Methods and orders are however currently not being send to Sendcloud.

Currently we can't update to Craft 4 because there are external and custom plugins than needs updating first. It did work just fine in the past.

Steps to reproduce

  1. Open general sendcloud settings and wait
  2. Open the Twig inspector and check the ajax logs

Additional info

Any help would be appreciated. Thanks!

meintjes22 commented 2 years ago

I also noticed that I can no longer push orders to sendcloud through the order. I get the following stack trace:

yii\base\UnknownPropertyException: Setting unknown property: white\commerce\sendcloud\models\OrderSyncStatus::lastWebhookTimestamp in /var/www/clients/client31/web60/web/shop/testing/vendor/yiisoft/yii2/base/Component.php:209
Stack trace:
#0 /var/www/clients/client31/web60/web/shop/testing/vendor/yiisoft/yii2/BaseYii.php(558): yii\base\Component->__set('lastWebhookTime...', NULL)
#1 /var/www/clients/client31/web60/web/shop/testing/vendor/yiisoft/yii2/base/BaseObject.php(107): yii\BaseYii::configure(Object(white\commerce\sendcloud\models\OrderSyncStatus), Object(white\commerce\sendcloud\records\OrderSyncStatus))
#2 /var/www/clients/client31/web60/web/shop/testing/vendor/white-nl/commerce-sendcloud/src/services/OrderSync.php(46): yii\base\BaseObject->__construct(Object(white\commerce\sendcloud\records\OrderSyncStatus))
#3 /var/www/clients/client31/web60/web/shop/testing/vendor/white-nl/commerce-sendcloud/src/SendcloudPlugin.php(144): white\commerce\sendcloud\services\OrderSync->getOrderSyncStatusByOrderId(78164)
#4 /var/www/clients/client31/web60/web/shop/testing/vendor/craftcms/cms/src/web/View.php(1590): white\commerce\sendcloud\SendcloudPlugin->white\commerce\sendcloud\{closure}(Array, false)
#5 /var/www/clients/client31/web60/web/shop/testing/storage_eu/runtime/compiled_templates/51/515a928e88d85ef916ad478ef476b7bc9ebf301d272971e62abb54fc49014166.php(166): craft\web\View->invokeHook('cp.commerce.ord...', Array)
#6 /var/www/clients/client31/web60/web/shop/testing/vendor/twig/twig/src/Template.php(182): __TwigTemplate_4c2742d0399e01c916c201306a1fe527f20a6ef6ace252b18d5d8eaf2f37f2d1->block_details(Array, Array)
#7 /var/www/clients/client31/web60/web/shop/testing/vendor/twig/twig/src/Template.php(254): Twig\Template->displayBlock('details', Array, Array, true)
#8 /var/www/clients/client31/web60/web/shop/testing/storage_eu/runtime/compiled_templates/af/af5af88ade4de10a0b09e7b2450ad5e96f5d0d8920be490e2107f40e663795cb.php(101): Twig\Template->renderBlock('details', Array, Array)
#9 /var/www/clients/client31/web60/web/shop/testing/vendor/twig/twig/src/Template.php(405): __TwigTemplate_3859f31d3bb0c285712b49da9870480cca3b7547c4a9e425f4d8eb1dcc09751a->doDisplay(Array, Array)
#10 /var/www/clients/client31/web60/web/shop/testing/vendor/twig/twig/src/Template.php(378): Twig\Template->displayWithErrorHandling(Array, Array)
#11 /var/www/clients/client31/web60/web/shop/testing/storage_eu/runtime/compiled_templates/51/515a928e88d85ef916ad478ef476b7bc9ebf301d272971e62abb54fc49014166.php(104): Twig\Template->display(Array, Array)
#12 /var/www/clients/client31/web60/web/shop/testing/vendor/twig/twig/src/Template.php(405): __TwigTemplate_4c2742d0399e01c916c201306a1fe527f20a6ef6ace252b18d5d8eaf2f37f2d1->doDisplay(Array, Array)
#13 /var/www/clients/client31/web60/web/shop/testing/vendor/twig/twig/src/Template.php(378): Twig\Template->displayWithErrorHandling(Array, Array)
#14 /var/www/clients/client31/web60/web/shop/testing/vendor/twig/twig/src/Template.php(390): Twig\Template->display(Array)
#15 /var/www/clients/client31/web60/web/shop/testing/vendor/twig/twig/src/TemplateWrapper.php(45): Twig\Template->render(Array, Array)
#16 /var/www/clients/client31/web60/web/shop/testing/vendor/twig/twig/src/Environment.php(318): Twig\TemplateWrapper->render(Array)
#17 /var/www/clients/client31/web60/web/shop/testing/vendor/craftcms/cms/src/web/View.php(389): Twig\Environment->render('commerce/orders...', Array)
#18 /var/www/clients/client31/web60/web/shop/testing/vendor/craftcms/cms/src/web/View.php(450): craft\web\View->renderTemplate('commerce/orders...', Array)
#19 /var/www/clients/client31/web60/web/shop/testing/vendor/craftcms/cms/src/web/Controller.php(241): craft\web\View->renderPageTemplate('commerce/orders...', Array, 'cp')
#20 /var/www/clients/client31/web60/web/shop/testing/vendor/craftcms/commerce/src/controllers/OrdersController.php(159): craft\web\Controller->renderTemplate('commerce/orders...', Array)
#21 [internal function]: craft\commerce\controllers\OrdersController->actionEditOrder('78164', Object(craft\commerce\elements\Order))
#22 /var/www/clients/client31/web60/web/shop/testing/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#23 /var/www/clients/client31/web60/web/shop/testing/vendor/yiisoft/yii2/base/Controller.php(180): yii\base\InlineAction->runWithParams(Array)
#24 /var/www/clients/client31/web60/web/shop/testing/vendor/craftcms/cms/src/web/Controller.php(190): yii\base\Controller->runAction('edit-order', Array)
#25 /var/www/clients/client31/web60/web/shop/testing/vendor/yiisoft/yii2/base/Module.php(528): craft\web\Controller->runAction('edit-order', Array)
#26 /var/www/clients/client31/web60/web/shop/testing/vendor/craftcms/cms/src/web/Application.php(274): yii\base\Module->runAction('commerce/orders...', Array)
#27 /var/www/clients/client31/web60/web/shop/testing/vendor/yiisoft/yii2/web/Application.php(103): craft\web\Application->runAction('commerce/orders...', Array)
#28 /var/www/clients/client31/web60/web/shop/testing/vendor/craftcms/cms/src/web/Application.php(259): yii\web\Application->handleRequest(Object(craft\web\Request))
#29 /var/www/clients/client31/web60/web/shop/testing/vendor/yiisoft/yii2/base/Application.php(386): craft\web\Application->handleRequest(Object(craft\web\Request))
#30 /var/www/clients/client31/web60/web/shop/testing/public/index.php(31): yii\base\Application->run()
#31 {main}
WHITE-developer commented 2 years ago

Hi @meintjes22 , Looks like this is not a problem on our side, but in Sendcloud itself as we are getting the same error directly through Sendcloud (https://api.sendcloud.dev/docs/sendcloud-public-api/shipping-methods/operations/list-shipping-methods).

meintjes22 commented 2 years ago

Hi @WHITE-developer ,

Thanks for your quick response!

I'm in contact with them regarding the API issue.

Do you have any idea what the issue could be regarding the Setting unknown property issue of my previous comment? I checked the logs in sendcloud and they also received that error while using the webhook url.

It's just weird as we did not change anything on our side.

WHITE-developer commented 2 years ago

I would expect that this is also from the API issues