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
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
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 aHOST
field.Shopify Docs say
HOST
is required. This was tricky to diagnose because:HOST
tohostName
in their code