craftcms / shopify

Synchronize and extend product data from your Shopify storefront.
MIT License
45 stars 25 forks source link

After install and Setup Backend is not working #88

Closed WitchcraftSolutions closed 5 months ago

WitchcraftSolutions commented 10 months ago
  1. Installed it and set it all up with the standart Shopify URL
  2. Then Set up a Custom Domain for the Store
  3. Then changed the shopify hostname to the new URL
  4. and then as soon i try to log in to my Craft backend i get the error below.

I tried Uninstall , Reinstall but as soon i Enter the Credentials and hit save i get this.

Additional info

TypeError: Cannot assign null to property Shopify\Auth\Session::$shop of type string in /home/witchcraftsolutions.com/dev/vendor/shopify/shopify-api/src/Auth/Session.php:32 Stack trace:

0 /home/witchcraftsolutions.com/dev/vendor/craftcms/shopify/src/services/Api.php(211): Shopify\Auth\Session->__construct()

1 /home/witchcraftsolutions.com/dev/vendor/craftcms/shopify/src/Plugin.php(248): craft\shopify\services\Api->getSession()

2 [internal function]: craft\shopify\Plugin->craft\shopify{closure}()

3 /home/witchcraftsolutions.com/dev/vendor/yiisoft/yii2/base/Event.php(312): call_user_func()

4 /home/witchcraftsolutions.com/dev/vendor/yiisoft/yii2/base/Component.php(642): yii\base\Event::trigger()

5 /home/witchcraftsolutions.com/dev/vendor/craftcms/cms/src/web/UrlManager.php(346): yii\base\Component->trigger()

6 /home/witchcraftsolutions.com/dev/vendor/craftcms/cms/src/web/UrlManager.php(115): craft\web\UrlManager->_getRules()

7 /home/witchcraftsolutions.com/dev/vendor/craftcms/cms/src/web/Request.php(1349): craft\web\UrlManager->parseRequest()

8 /home/witchcraftsolutions.com/dev/vendor/yiisoft/yii2/web/Application.php(82): craft\web\Request->resolve()

9 /home/witchcraftsolutions.com/dev/vendor/craftcms/cms/src/web/Application.php(290): yii\web\Application->handleRequest()

10 /home/witchcraftsolutions.com/dev/vendor/yiisoft/yii2/base/Application.php(384): craft\web\Application->handleRequest()

11 /home/witchcraftsolutions.com/dev/web/index.php(12): yii\base\Application->run()

12 {main}

lukeholder commented 5 months ago

If this issue persisted, please send a support ticket to suppoer@craftcms.com with

we can then take a look at this issue that seems to be specific to your installation. Thanks.

benjaminkohl commented 4 months ago

I am receiving this exact same exception that prevents access to the entire control panel. In my case, I was setting the plugin settings to use environment variables, clicked "Save" and then saw this exception. Then tried navigating to other pages in the control panel and I see this exception thrown on any CP URL.

Craft 5.1.3 Shopify Plugin 5.1.1

benjaminkohl commented 4 months ago

After review, it appears the Utils::sanitizeShopDomain() method in the Shopify library has a second parameter for custom domains and it looks like the plugin is only passing a single $shop parameter.

https://github.com/Shopify/shopify-api-php/blob/main/src/Utils.php#L32

ryanmasuga commented 4 months ago

We have two hybrid Craft / Shopify projects riding on whether this will work for us or not, but we cannot test because it prevents access to the CP when installed. Can this ticket be reopened? Or is it better to email support?

benjaminkohl commented 4 months ago

For anyone that finds this issue, I posted a new issue at the repo for the underlying shopify PHP package. It was that package's Auth/Session class calling the sanitization method without the using the custom domain parameter.