MONEI / Shopify-api-node

Node Shopify connector sponsored by MONEI
https://monei.com/shopify-payment-gateway/
MIT License
946 stars 277 forks source link

Not able to get products #414

Closed antero10 closed 3 years ago

antero10 commented 4 years ago

Hi,

I've been trying to get products using private app Admin API credentials, like this

this.shopify = new Shopify({
            shopName: 'xxxx',
            apiKey: 'd12313....',
            password: 'shppa_....'
});

and i'm trying to get the list of products like this

const products = await this.shopify.product.list();

However, my result it's undefined and not sure why i'm getting that result. Can anyone help me with this?

alexunm commented 3 years ago

Hey,

I think I have a similar issue. I get undefined response for all resource requests.

this.api = new Shopify({
      shopName: account.myshopify_domain,
      accessToken: account.token
})

...
const shopRes = await this.api.shop.get() // shopRes = undefined

Making the requests using the rest API with the same credentials works. https://{account.myshopify_domain}/admin/api/2020-04/shop.json X-Shopify-Access-Token: {account.token}

Israel001 commented 3 years ago

@antero10 This works for me:

 new Shopify({ shopName: 'YOUR_SHOP_NAME', accessToken: 'YOUR_PASSWORD' });
alexunm commented 3 years ago

Hey,

I think I have a similar issue. I get undefined response for all resource requests.

this.api = new Shopify({
      shopName: account.myshopify_domain,
      accessToken: account.token
})

...
const shopRes = await this.api.shop.get() // shopRes = undefined

Making the requests using the rest API with the same credentials works. https://{account.myshopify_domain}/admin/api/2020-04/shop.json X-Shopify-Access-Token: {account.token}

Solved my issue, it was related to CORS.