Shopify / shopify-marketplaces-admin-app

MIT License
38 stars 45 forks source link

Uncaught TypeError: Cannot read properties of undefined (reading 'adminShop') #4

Closed soufianeh closed 2 years ago

soufianeh commented 2 years ago

Following the documentation here: https://shopify.dev/marketplaces/getting-started/get-started-with-shopify-marketplace-kit, I get to the end of the tutorial, after trying to access my app: https://{SHOPIFY_STORE}.myshopify.com/admin/apps/{APP_ID}/, I get this:

Uncaught TypeError: Cannot read properties of undefined (reading 'adminShop')     at Home (Home.jsx:33:5)

It seems to be related to this query:

gql`
  query HomePageQuery {
    adminShop {
      id
      domain
      appHandle
      publicationId
      availableProductCount
      onboardingInfoCompleted
      onboardingCompleted
    }
  }`
SmolSoftBoi commented 2 years ago

Similar issue, not sure how best to debug these queries.

Karen-boop commented 2 years ago

Hey there, thanks for opening the issue :)

This error means the app does not know what adminShop is defined as. This can happen for a few reasons, all easy to fix.

  1. The app is not installed on the dev store Solve by clicking on the link generate by the CLI when you run shopify app serve. It should look something like:

⭑ To install and start using your app, open this URL in your browser: https://d52a-86-40-45-68.ngrok.io/auth?shop=test-dev-1.myshopify.com

  1. The SHOP in the .env file does not match the dev store you are currently logged into via the CLI Solve by running Shopify CLI commandshopify whoami and make sure it matches the SHOP variable in your .env file.

  2. The link is incorrect. Solve by navigating to the app within the Shopify admin of the dev store.

SmolSoftBoi commented 2 years ago

Hey there, thanks for opening the issue :)

This error means the app does not know what adminShop is defined as. This can happen for a few reasons, all easy to fix.

  1. The app is not installed on the dev store Solve by clicking on the link generate by the CLI when you run shopify app serve. It should look something like:

⭑ To install and start using your app, open this URL in your browser: https://d52a-86-40-45-68.ngrok.io/auth?shop=test-dev-1.myshopify.com

  1. The SHOP in the .env file does not match the dev store you are currently logged into via the CLI Solve by running Shopify CLI commandshopify whoami and make sure it matches the SHOP variable in your .env file.
  2. The link is incorrect. Solve by navigating to the app within the Shopify admin of the dev store.

I'm having the same issue and tried all these, but despite them all being correct, the issue persists.