Shopify-api-node icon indicating copy to clipboard operation
Shopify-api-node copied to clipboard

Error: Missing or invalid options

Open AxelTheGerman opened this issue 2 years ago • 0 comments

Hi,

First of, thank you for building this library!

I was hoping my issue would be a duplicate of #220 or #378 but I'm using this library through another tool to build a Shopify app.

I'm getting the following error:

Error: Missing or invalid options
    at new Shopify (/gadget/app/node_modules/shopify-api-node/index.js:58:11)

Since I'm not actually passing anything directly, it would be really great if there was a little more detail on what isn't being passed correctly.

After all there are quite a few scenarios

  if (
    !options ||
    !options.shopName ||
    (!options.accessToken && (!options.apiKey || !options.password)) ||
    (options.accessToken && (options.apiKey || options.password)) ||
    (options.autoLimit && options.maxRetries)
  ) {
    throw new Error('Missing or invalid options');
  }

Sad to see that there was an attempt to improve the developer experience here in #379 and while I agree that the approach was maybe a bit too extreme I wish this wouldn't still affect developers 3 years later

AxelTheGerman avatar Nov 27 '23 02:11 AxelTheGerman