Shopify / koa-shopify-auth

DEPRECATED Middleware to authenticate a Koa application with Shopify
MIT License
80 stars 63 forks source link

TypeError [ERR_INVALID_ARG_TYPE] #35

Closed maxnowack closed 1 year ago

maxnowack commented 3 years ago

Issue summary

I've followed the nodejs and react tutorial to build an app, but I'm getting errors when I try to install my app to my test store via the partners dashboard.

Expected behavior

The app should be installed in the test store.

Actual behavior

I'm getting the following errors when I try to install my app to my test store via the partners dashboard:

  TypeError [ERR_INVALID_ARG_TYPE]: The "key" argument must be of type string or an instance of Buffer, TypedArray, DataView, or KeyObject. Received undefined
      at prepareSecretKey (internal/crypto/keys.js:322:11)
      at new Hmac (internal/crypto/hash.js:111:9)
      at Object.createHmac (crypto.js:147:10)
      at sign (…/node_modules/keygrip/index.js:23:8)
      at Keygrip.sign (…/node_modules/keygrip/index.js:30:38)
      at Cookies.set (…/node_modules/cookies/index.js:110:30)
      at oAuthStart (…/node_modules/@shopify/koa-shopify-auth/dist/src/auth/create-oauth-start.js:18:21)
      at …/node_modules/@shopify/koa-shopify-auth/dist/src/auth/index.js:55:46
      at step (…/node_modules/tslib/tslib.js:141:27)
      at Object.next (…/node_modules/tslib/tslib.js:122:57)
  TypeError [ERR_INVALID_ARG_TYPE]: The "key" argument must be of type string or an instance of Buffer, TypedArray, DataView, or KeyObject. Received undefined
      at prepareSecretKey (internal/crypto/keys.js:322:11)
      at new Hmac (internal/crypto/hash.js:111:9)
      at Object.createHmac (crypto.js:147:10)
      at sign (…/node_modules/keygrip/index.js:23:8)
      at Keygrip.sign (…/node_modules/keygrip/index.js:30:38)
      at Cookies.set (…/node_modules/cookies/index.js:110:30)
      at topLevelOAuthRedirect (…/node_modules/@shopify/koa-shopify-auth/dist/src/auth/create-top-level-oauth-redirect.js:10:21)
      at …/node_modules/@shopify/koa-shopify-auth/dist/src/auth/index.js:61:46
      at step (…/node_modules/tslib/tslib.js:141:27)
      at Object.next (…/node_modules/tslib/tslib.js:122:57)

Steps to reproduce the problem

  1. Setup a test app like in the tutorial
  2. Install it to a test store via the partners dashboard

Reduced test case

The best way to get your bug fixed is to provide a reduced test case.


Checklist

hannachen commented 3 years ago

Hi there, thanks for reporting this issue. I ran into the same issue and was able to resolve it by double-checking my .env file: https://community.shopify.com/c/Shopify-Apps/First-app-problem/td-p/508242

github-actions[bot] commented 1 year ago

Note that this repo is no longer maintained and this issue will not be reviewed. Prefer the official JavaScript API library. If you still want to use Koa, see simple-koa-shopify-auth for a potential community solution.