skip to Main Content

I am working with "shopify" and "nodejs",Right now i am trying to integrate "shopify module" in nodejs,But i am getting following error

"ShopifyError: Cannot initialize Shopify API Library. Missing values for: hostName"

Here is my config.js code (node_modules/@shopify/shopify-api/lib/config.js",Is this hostname right or where can i get hostname ? why i am getting error "missing hostname" ?

var config = {
        apiKey: '',
        apiSecretKey: '',
        scopes: new scopes_1.AuthScopes([]),
        hostName: 'https://partners.shopify.com/xxxxx/stores',
        hostScheme: 'https',
        apiVersion: types_1.LATEST_API_VERSION,
        isEmbeddedApp: true,
        isPrivateApp: false,
        logger: {
            log: defaultLogFunction,
            level: types_1.LogSeverity.Info,
            httpRequests: false,
            timestamps: false,
        },
    };

2

Answers


  1. I had the same error using npm run dev as suggested by the Shopify docs.

    I resolved the issue by using the Shopify CLI. To start the dev server you can use the command npm run shopify app dev

    Login or Signup to reply.
  2. I had a this issue when attempting npm run serve (the default command for production environment with their Docker configuration). In my case, the .env was missing a HOST field.

    Shopify Docs say HOST is required. This was tricky to diagnose because:

    1. Shopify doesn’t create a HOST field in the env by default
    2. Shopify doesn’t parse/validate the ENV up front
    3. Shopify’s error message directs developer to a node_modules file
    4. Shopify renames HOST to hostName in their code
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search