‘use strict’;
require(‘dotenv’).config();
const log4js = require(‘log4js’);
const {AppApiKey, AppApiPassword, shopName, SHOPIFY_SHOP_PLAN} = process.env;
const Shopify = require(‘shopify-api-node’);
const shopify = new Shopify({
shopName: shopName,
apiKey: AppApiKey,
password: AppApiPassword
});
/*
Description : Get shopify staff user
@Created_by :Supriya Shirote
@Anonymous null
@Return : shopify staff user details.
*/
const getUserDetails = async (res, req) => {
console.log(‘hi test’);
const sessionToken = shopify;
const staffMembers = await Shopify.rest.User.all({
session: sessionToken,
});
console.log("staffMembers info: "+ JSON.stringify(staffMembers));
}
module.exports = {
getUserDetails
};
But I am getting this error
C:\Audit-info\controllers\shopifyApi.js:26
const staffMembers = await Shopify.rest.User.all({
^
TypeError: Cannot read properties of undefined (reading ‘User’)