You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Resolving TypeError: Shopify\Utils::sanitizeShopDomain(): Argument #1 ($shop) must be of type string, null given #540
As well as many others I often get the following error too: TypeError: Shopify\Utils::sanitizeShopDomain(): Argument #1 ($shop) must be of type string, null given, called in /app/app/Lib/AuthRedirection.php on line 17 in file /app/vendor/shopify/shopify-api/src/Utils.php on line 36
It occurs when the webserver gets a malformed call (without the shop parameter basically), and this may happen for many reasons. (In my opinion this looks more like a bug then an enhancement, but the application still works even if the log files gets filled with plenty of lines of this error)
Motivation
The function Shopify\Utils::sanitizeShopDomain should be called either with an empty string as fallback for its first parameter: Utils::sanitizeShopDomain($request->query("shop", '')) like HERE,
or with a guard on the first parameter: $shop = $request->query('shop') ? Utils::sanitizeShopDomain($request->query('shop')) : null; like HERE
(Then the code should deal with the case $shop = null of course), otherwise it throws a TypeError exception because $request->query('shop') returns null and not a string (as requested by the signature of Utils::sanitizeShopDomain) if the shop variable is missing from the query params.
Activity
nafeeur360 commentedon Jul 12, 2026
If you run the application outside the Shopify admin, then it will not get the
shopparameter. Then this error will occur. It's not a bug, actually.