Closed LiuYuYang01 closed 1 month ago
The console prompts this:ensureInstalledOnShop did not receive a shop query argument | {shop: undefined}
Here is the code for shopify.js
import { BillingInterval, LATEST_API_VERSION } from "@shopify/shopify-api";
import { shopifyApp } from "@shopify/shopify-app-express";
import { SQLiteSessionStorage } from "@shopify/shopify-app-session-storage-sqlite";
import { restResources } from "@shopify/shopify-api/rest/admin/2023-04";
const DB_PATH = `${process.cwd()}/database.sqlite`;
// The transactions with Shopify will always be marked as test transactions, unless NODE_ENV is production.
// See the ensureBilling helper to learn more about billing in this template.
const billingConfig = {
"My Shopify One-Time Charge": {
// This is an example configuration that would do a one-time charge for $5 (only USD is currently supported)
amount: 5.0,
currencyCode: "USD",
interval: BillingInterval.OneTime,
},
};
const shopify = shopifyApp({
api: {
apiVersion: LATEST_API_VERSION,
restResources,
billing: undefined, // or replace with billingConfig above to enable example billing
},
auth: {
path: "/api/auth",
callbackPath: "/api/auth/callback",
},
webhooks: {
path: "/api/webhooks",
},
// This should be replaced with your preferred storage strategy
sessionStorage: new SQLiteSessionStorage(DB_PATH),
});
export default shopify;
Please take a look at it when you have time. Thank you very much
Hi @LiuYuYang01, thank you for opening this issue. Which URL did you use to open the app?
I opened it through him, directly or in shopify: No shop provided ➜ Local: http://localhost:53384/
Hi @LiuYuYang01, thank you for opening this issue. Which URL did you use to open the app?
I opened it through him, directly or in shopify: No shop provided ➜ Local: http://localhost:53384/
@LiuYuYang01 could you try using the preview functionality of the CLI? Try pressing p
after running dev
.
Hi LiuYuYang01,
This issue occurs because the shop parameter is not defined in the URL. To install the app on your Shopify store, you need to include the shop parameter in the URL.
Please use the following URL, replacing "your_shop_url" with your actual Shopify store URL:
http://localhost:53384/?shop=your_shop_url.myshopify.com
This will redirect you to the Shopify installation page, where you can complete the app installation process.
It usually occurs when the session token is not valid. Maybe try using useAuthenticated fetch
Current Shopify CLI version: 3.64.1 current nodejs version is 20
English:Hello, why does the shopify-app-template-node code run without moving anything, the page shows: "No shop provided", is there a solution