Shopify / shopify-marketplaces-admin-app

MIT License
38 stars 45 forks source link

TypeError: Cannot read properties of null (reading 'storefrontAccessToken') #53

Open valorloff opened 1 year ago

valorloff commented 1 year ago

Hi! I trying test shopify-marketplaces-admin-app with shopify-marketplaces-buyer-app, but during install channel (admin) app on dev store i get error:

TypeError: Cannot read properties of null (reading 'storefrontAccessToken')
    at _callee$ (/home/xxxxxx/projects/shopify-marketplaces-admin-app/server/handlers/mutations/create-storefront-access-token.js:22:53)

console.log('server/handlers/mutations/create-storefront-access-token.js',resp.body.data.storefrontAccessTokenCreate); // null

Docs says, that need setup ApolloClient

const client = new ApolloClient({
  uri: `https://${domain}/api/2023-04/graphql.json`,
  headers: {
    "X-Shopify-Storefront-Access-Token": storefrontAccessToken,
  },
  cache: new InMemoryCache(),
  });
  const { data } = await client.query({
  query: SHOP_PRODUCTS_QUERY,
  });
  setData(data);

but if look closely at the code, storefrontAccessToken generated automatically based on shopName, how its works ? Would love to try and see marketplace kit in action.