Shopify / shopify-app-template-php

263 stars 85 forks source link

Shopify\Utils::sanitizeShopDomain(): Argument #1 ($shop) must be of type string, null given, called in C:\laragon\www\shopify-first-app\web\app\Lib\AuthRedirection.php on line 17 #487

Open mathishuettl opened 7 months ago

mathishuettl commented 7 months ago

Issue summary

Write a short description of the issue here ↓ I get the following error, when I access http://localhost:56554

Shopify\Utils::sanitizeShopDomain(): Argument #1 ($shop) must be of type string, null given, called in C:\laragon\www\shopify-first-app\web\app\Lib\AuthRedirection.php on line 17

Expected behavior

What do you think should happen? App frontend is shown

Steps to reproduce the problem

I followed the installation steps

sinarahmany commented 6 months ago

I'm having the same issue but after a bit of googling it turned out many have this issue and you should do the local development using the "Preview URL" given when you run npm run dev.

qualia-user commented 6 months ago

I'm having the same issue but after a bit of googling it turned out many have this issue and you should do the local development using the "Preview URL" given when you run npm run dev.

Nope, preview URL only redirects you to admin.shopify.com/store . From there you can see your app embedded, but that doesn't solve anything.

As far as I could understand, the error occurs with the middleware in the 'EnsureShopifyInstalled' class. It turns out that there is no shop key in the request, so the helper method 'sanitizeShopDomain' returns an error.

I'm guessing it's a configuration error, but I still haven't been able to figure it out.

Has anyone had a similar problem, does anyone have a suggestion on how to debug or point in some direction?

Thank you

kamalsharma9392 commented 3 months ago

Hey @qualia-user , I'm encountering the same problem where I can't access the app outside of the Shopify admin. I attempted to pass the shop in the query parameters to troubleshoot, but it seems to require additional parameters that ultimately direct me back to the Shopify admin. If anyone has found a solution, I'd appreciate it if you could share.