无法使用Node初始化Shopify API库

ercv8c1e  于 2023-05-28  发布在  Node.js
关注(0)|答案(1)|浏览(186)

我试图运行一个Shopify应用程序后,他们的Node template,但我得到这个错误:

shopify-api/lib/config.js:50
        throw new error_1.ShopifyError(`Cannot initialize Shopify API Library. Missing values for: ${missing.join(', ')}`);
              ^

ShopifyError: Cannot initialize Shopify API Library. Missing values for: apiSecretKey, hostName, apiKey, scopes
    at validateConfig (.../apps/shopify_banner_app/banner-app/web/node_modules/@shopify/shopify-api/lib/config.js:50:15)
    at Object.shopifyApi (.../apps/shopify_banner_app/banner-app/web/node_modules/@shopify/shopify-api/lib/index.js:31:57)
    at shopifyApp (.../apps/shopify_banner_app/banner-app/web/node_modules/@shopify/shopify-app-express/build/cjs/index.js:27:26)
    at .../apps/shopify_banner_app/banner-app/web/shopify.js:19:17
    at ModuleJob.run (node:internal/modules/esm/module_job:193:25)

Node.js v19.8.1
[nodemon] app crashed - waiting for file changes before starting...

如何解决此问题?

zysjyyx4

zysjyyx41#

您缺少API凭据和配置

const shopify = shopifyApi({
  // The next 4 values are typically read from environment variables for added security
  apiKey: 'APIKeyFromPartnersDashboard',
  apiSecretKey: 'APISecretFromPartnersDashboard',
  scopes: ['read_products'],
  hostName: 'ngrok-tunnel-address',
  ...
});

相关问题