Shopify / shopify-marketplaces-admin-app

MIT License
38 stars 45 forks source link

Issue setting up this app #8

Closed agroebe closed 2 years ago

agroebe commented 2 years ago

Is this sample app even maintained and working?

I was referred to this repository from the Shopify marketplaces documentation and this has been an absolute nightmare to setup. I fixed most of the setup issues and have the app server running locally, but there's all kind of console errors as shown below:

chrome_2022-05-03_00-06-20

Any ideas?

SerhiDi commented 2 years ago

@agroebe hello, I found this issue almost 2 months ago. Issue link. There are no solutions and corrections in the project and most likely will not be. Dead project.

misshula commented 2 years ago

appreciate the feedback! we will take a look early next week and report back. sorry for the confusion.

misshula commented 2 years ago

I've put up a PR to try to resolve these issues. I will get someone to review tomorrow. Not sure if this is the same issue or not, but hoping this fixes what you are both seeing.

komal1118 commented 2 years ago

Having an issue myself trying to link from one page to another using the cards. How does one go from a get started card to a login card. Once there how does one login and where is that stored? Just the basics are confusing.

misshula commented 2 years ago

Which specifically? Have you checked out Channels-UI which is an extension of Polaris?

komal1118 commented 2 years ago

We have checked those. We might be missing something. We created the cards using the codes available on https://polaris.shopify.com/components/get-started - there is however, no code that can help something connect it all together.

ChiefGearHead commented 2 years ago

@misshula We can't seem to get the out of the box routing working. From the ExtendedAppProvider/AppProvider it seems that we can't get the app to navigate to the included default onboarding and settings pages.

misshula commented 2 years ago

@ChiefGearHead what starting url are you trying to access? I have a PR to accommodate for different version of shopify-cli

ie: replace auth with login of vice versa depending on version of cli.

ChiefGearHead commented 2 years ago

@misshula thank you for your response. Starting with the root URL and trying to navigate to /onboarding and /settings which are part of the default code in the repo before we even customized anything. However this only gives a blank screen. Does the PR that you mentioned fix this?

misshula commented 2 years ago

it should I will merge and you can re-pull

misshula commented 2 years ago

should be closed with https://github.com/Shopify/shopify-marketplaces-admin-app/pull/12

ChiefGearHead commented 2 years ago

Thank you @misshula!

ChiefGearHead commented 2 years ago

We pulled the update and redeployed, and now it seems that as soon as we launch the app, we get a quick flash of content and then a blank screen. Do you have any ideas on how we can fix this? This is still the out-of-the-box code with the example straight from the Channel UI docs homepage: https://github.com/Shopify/channels-ui-docs. If it helps and you have the time, we can jump on a zoom as well to demonstrate. The code in question is below:

import React from 'react';
import {ExtendedAppProvider, IntroductionPage} from '@shopify/channels-ui';
import {Outlet} from 'react-router';
import polarisTranslations from '@shopify/polaris/locales/en.json';
import translations from '@shopify/channels-ui/locales/en.json';
import GraphQLProvider from './GraphQL';
import Link from './Link';

import '@shopify/polaris/dist/styles.css';
import '@shopify/channels-ui/dist/styles.css';
import RoutePropagator from './RoutePropagator';
import {Card, Button} from '@shopify/polaris';

const AppProvider = () => {
  return (
    <ExtendedAppProvider
      polaris={{i18n: polarisTranslations, linkComponent: Link}}
      i18n={translations}
      config={{
        host: new URL(location).searchParams.get('host'),
        apiKey: API_KEY,
        forceRedirect: true,
      }}
    >
      <IntroductionPage title="Example channel">
        <Card title="Welcome" sectioned>
          <Button onClick={() => alert('Button clicked!')}>
            Example button
          </Button>
        </Card>
      </IntroductionPage>
      <GraphQLProvider>
        <Outlet />
        <RoutePropagator />
      </GraphQLProvider>
    </ExtendedAppProvider>
  );
};

export default AppProvider;
misshula commented 2 years ago

Do you have any ideas on how we can fix this?

Can you try updating to the latest Shopify CLI? Can you also share your console logs?

JohnFoxtrot commented 2 years ago

@misshula Cloned after the PR you linked was committed (cloned late July 2022) and was still having the same issue as @agroebe.

Screenshot 2022-08-01 122449

I got passed that error with the aid of the react-fire-dom patch:

npm install @hot-loader/react-dom@16.14.0

and rewiring the webpack.conf.js file

... resolve: { alias: { 'react-dom': '@hot-loader/react-dom' } } ...

I re-install the unlisted app using the ngrok login URL and then I'm hit with this error:

Screenshot 2022-08-01 153150

Where is the data for "adminShop" supposed to be coming from? Per the GQL query with the GraphiQL App (below) the data is not found. My SQLite dB migration had no issues (all 4 table schemas migrated properly).

Screenshot 2022-08-01 164338

Not sure if it's relevant but I'm using CLI 2.20.1

Any suggestions?

misshula commented 2 years ago

thanks for the detail @JohnFoxtrot - we will take a look to see what's happening. on quick look, you've taken the right approach to debug - not certain why the adminShop is undefined

JohnFoxtrot commented 2 years ago

@misshula Looking at the CLI log for Shopify App Serve, after I install the unlisted app I get the following error:

TypeError: Cannot read properties of null (reading 'storefrontAccessToken')
at _callee$ (C:\shopify-marketplaces-admin-app\server\handlers\mutations\/create-storefront-access-token.js:22:53)
at tryCatch (C:\shopify-marketplaces-admin-app\node_modules\regenerator-runtime\runtime.js:63:40)
at Generator.invoke [as _invoke] (C:\shopify-marketplaces-admin-app\node_modules\regenerator-runtime\runtime.js:294:22)
at Generator.next (C:\shopify-marketplaces-admin-app\node_modules\regenerator-runtime\runtime.js:119:21)
at asyncGeneratorStep (C:\shopify-marketplaces-admin-app\server\handlers\mutations\create-storefront-access-token.js:10:103)
at _next (C:\shopify-marketplaces-admin-app\server\handlers\mutations\create-storefront-access-token.js:12:194)
at processTicksAndRejections (node:internal/process/task_queues:96:5)

The line referenced in create-storefront-access-token.js is the mutation for the access token which is returning null:

  return resp.body.data.storefrontAccessTokenCreate.storefrontAccessToken
    .accessToken;

With respect to that line, my IDE is throwing an error that "storefrontAccessTokenCreate" is an unresolved variable. Is this line accurate?

Presumably this issue is cascading and causing the other gql/rest calls to return null as well?

misshula commented 2 years ago

@JohnFoxtrot have you setup your app as a Sales Channel?

JohnFoxtrot commented 2 years ago

@misshula It is now.... 😑

Thanks - appreciate it

misshula commented 2 years ago

awesome!