Closed ivalsaraj closed 4 years ago
It is optional. I can't reproduce the issue:
$ cat gh-404.js
'use strict';
const Shopify = require('shopify-api-node');
const shopify = new Shopify({
shopName: 'quuz',
apiKey: 'b68c3a4bf44cd240511e5f4114f0be4d',
password: '2d170167fc62551920ca60fe40a5e548'
});
(async function () {
const shop = await shopify.shop.get();
console.log(shop);
})().catch(console.error);
$ node gh-404.js
{
id: 19563841,
name: 'quuz',
email: 'al.bino@rocketmail.com',
domain: 'quuz.myshopify.com',
province: 'Roma',
country: 'IT',
address1: 'Via Roma 1',
zip: '12345',
city: 'Rome',
source: null,
phone: '',
latitude: 42.137833,
longitude: 12.380085,
primary_locale: 'en',
address2: null,
created_at: '2017-04-26T03:47:03-04:00',
updated_at: '2020-07-06T18:31:41-04:00',
country_code: 'IT',
country_name: 'Italy',
currency: 'EUR',
customer_email: 'al.bino@rocketmail.com',
timezone: '(GMT-05:00) Eastern Time (US & Canada)',
iana_timezone: 'America/New_York',
shop_owner: 'Al Bino',
money_format: '€{{amount}}',
money_with_currency_format: '€{{amount}} EUR',
weight_unit: 'kg',
province_code: 'RM',
taxes_included: true,
tax_shipping: null,
county_taxes: true,
plan_display_name: 'Development',
plan_name: 'affiliate',
has_discounts: false,
has_gift_cards: false,
myshopify_domain: 'quuz.myshopify.com',
google_apps_domain: null,
google_apps_login_enabled: null,
money_in_emails_format: '€{{amount}}',
money_with_currency_in_emails_format: '€{{amount}} EUR',
eligible_for_payments: true,
requires_extra_payments_agreement: false,
password_enabled: true,
has_storefront: true,
eligible_for_card_reader_giveaway: false,
finances: true,
primary_location_id: 42043015,
cookie_consent_level: 'implicit',
visitor_tracking_consent_preference: 'allow_all',
force_ssl: true,
checkout_api_supported: false,
multi_location_enabled: true,
setup_required: false,
pre_launch_enabled: false,
enabled_presentment_currencies: [ 'EUR' ]
}
Thank you for your response. But we are getting this on production after on new version.
Here is the log
Error from discount controller Error: Missing or invalid options at new Shopify (/usr/src/app/node_modules/shopify-api-node/index.js:36:11) at applyDiscounts (/usr/src/app/src/controllers/api/v1/discount/services/applyDiscounts/index.js:100:25) at runMicrotasks (<anonymous>) at processTicksAndRejections (internal/process/task_queues.js:97:5)
The above error is coming from axios
not shopify-api-node
see
at createError (/usr/src/app/node_modules/axios/lib/core/createError.js:16:15)
shopify-api-node
does not use axios
.
@lpinca Thank you for your response, I am sorry I've pasted the wrong log before, now I updated the right one above.
Missing or invalid options
This error is happening on some requests only, Could you please let me know what would be the main reason for Missing or invalid options
issue?
You need to specify (apiKey
& password
) or (accessToken
). Those two are mutually exclusive. See https://github.com/MONEI/Shopify-api-node/blob/4f099ffcb84d0ef967267bd440e39e62572fa5a2/index.js#L30-L37
Closing as answered. Discussion can continue if needed.
How to reproduce?
When Initialize the Shopify Instance without apiVersion (In the readme.md, it show apiVersion is optional), getting
TypeError: Cannot read property 'apiVersion'
errorSuggestion: If the apiVersion is missing, why not there is a fallback version set without getting this error.
Thanks