MONEI / Shopify-api-node

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

Error: Missing or Invalid Options #378

Closed TomGranot closed 4 years ago

TomGranot commented 4 years ago

Looked at https://github.com/MONEI/Shopify-api-node/issues/220, but that is not exactly my case.

I've got a public app (in draft currently), and I'm trying to call the Shopify-api-node module like so:

const Shopify = require('shopify-api-node');
  const shopify = new Shopify({
    shopOrigin: `${shopOrigin}`,
    accessToken: `${accessToken}`
  })

Where both shopOrigin and accessToken are properly defined and hold the correct (to my understanding) values. More specifically:

  1. My shopOrigin is of the form shop-name.myshopify.com,
  2. MyaccessToken is grabbed from the cookies provided by the koa-shopify-auth packag

Still getting Error: Missing or invalid options despite this being a public app, and the fact that I only provided the accessToken and shopName parameters (and not the other, private app options).

Any thoughts?

And of course, thank you for this package! I'm attempting to integrate it with the official Node.js + React + Next tutorial, and specifically use it to skip writing proper pagination logic for the REST admin API.

Side note: Looking at https://github.com/MONEI/Shopify-api-node/blob/master/index.js#L31-L38, it's probably smart to add better error handling here.

Added PR https://github.com/MONEI/Shopify-api-node/pull/379, not really tested against anything for now - just let me know if it makes sense and I'll add tests, TypeScript type definitions, etc.

lpinca commented 4 years ago

The shopOrigin option does not exist. You probably want to use the shopName option instead.

TomGranot commented 4 years ago

@lpinca reading is an important skill for a programmer, that's for sure. :) Made a PR out of it, so I guess it's a net win, though.

Thanks a lot!