Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I am getting Context Undefined error #1

Open
itsanishjain opened this issue Aug 30, 2024 · 0 comments
Open

I am getting Context Undefined error #1

itsanishjain opened this issue Aug 30, 2024 · 0 comments

Comments

@itsanishjain
Copy link

I am trying to make this work for the current the things

currently when you run Shopify app init it's come with Vite but I still added the remix.config.js file

export const initShopify = (context: AppLoadContext) => {
  const shopify = shopifyApp({
    apiKey: process.env.SHOPIFY_API_KEY!,
    apiSecretKey: process.env.SHOPIFY_API_SECRET || "",
    apiVersion: LATEST_API_VERSION,
    scopes: process.env.SCOPES?.split(","),
    appUrl: process.env.SHOPIFY_APP_URL || "",
    authPathPrefix: "/auth",
    sessionStorage: new KVSessionStorage(context.env.SESSION),
    distribution: AppDistribution.AppStore,
    restResources,
    webhooks: {
      APP_UNINSTALLED: {
        deliveryMethod: DeliveryMethod.Http,
        callbackUrl: "/webhooks",
      },
    },
    hooks: {
      afterAuth: async ({ session }) => {
        shopify.registerWebhooks({ session });
      },
    },
    future: {},
    ...(process.env.SHOP_CUSTOM_DOMAIN
      ? { customShopDomains: [process.env.SHOP_CUSTOM_DOMAIN] }
      : {}),
  });

  return shopify;
};

When I console log my context is undefined any idea on how I should fix this

I even try to do this vite.config.js file

but then I get other error related to css bundling, any thoughts on how to this

this is what you get

I know the current code is not generating .env.devs file maybe because of both remix and vite config file

now idea why
image

Here is code that's gives this ^ error
https://github.com/itsanishjain/stable-benchmark-app

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant