Closed hsintrodev closed 2 years ago
Looks like changing const { query, scopes } = req.body to const { query, scopes } = req; in the handleAUthStart.js file resolves the issue.
ok I think this is due to me using api/auth as the authentication entry, useOAuth is in the index file and using axios. Looks like this causes the request to be slightly different. We can close this now. Thanks!
Thank you so much for the amazing work! A total newbie here. I've cloned the NexJS project and when trying to install the app using/api/auth?shop=, I get the following error. I have not made any code changes to the project:
TypeError: Cannot read properties of undefined (reading 'shop') at _callee$ (/mnt/d/Projects/Shopify/shopify-session-tokens-nextjs/node_modules/shopify-nextjs-toolbox/lib/middleware/oauth/handleAuthStart.js:28:25) at tryCatch (/mnt/d/Projects/Shopify/shopify-session-tokens-nextjs/node_modules/regenerator-runtime/runtime.js:63:40) at Generator.invoke [as _invoke] (/mnt/d/Projects/Shopify/shopify-session-tokens-nextjs/node_modules/regenerator-runtime/runtime.js:293:22) at Generator.next (/mnt/d/Projects/Shopify/shopify-session-tokens-nextjs/node_modules/regenerator-runtime/runtime.js:118:21) at asyncGeneratorStep (/mnt/d/Projects/Shopify/shopify-session-tokens-nextjs/node_modules/shopify-nextjs-toolbox/node_modules/@babel/runtime/helpers/asyncToGenerator.js:3:24) at _next (/mnt/d/Projects/Shopify/shopify-session-tokens-nextjs/node_modules/shopify-nextjs-toolbox/node_modules/@babel/runtime/helpers/asyncToGenerator.js:25:9) at /mnt/d/Projects/Shopify/shopify-session-tokens-nextjs/node_modules/shopify-nextjs-toolbox/node_modules/@babel/runtime/helpers/asyncToGenerator.js:32:7 at new Promise (<anonymous>) at /mnt/d/Projects/Shopify/shopify-session-tokens-nextjs/node_modules/shopify-nextjs-toolbox/node_modules/@babel/runtime/helpers/asyncToGenerator.js:21:12 at /mnt/d/Projects/Shopify/shopify-session-tokens-nextjs/node_modules/shopify-nextjs-toolbox/lib/middleware/oauth/handleAuthStart.js:72:19
I think that this error is due to trying to access the shop property on an undefined object? Is there something I can do to resolve it?
I'm using the v2 of the shopify-nextjs-toolbox. Here is my package.json:
"dependencies": { "@shopify/app-bridge": "^2.0.3", "@shopify/app-bridge-react": "^2.0.3", "@shopify/app-bridge-utils": "^2.0.3", "@shopify/polaris": "^6.6.0", "axios": "^0.21.0", "global": "^4.4.0", "js-cookie": "^2.2.1", "jsonwebtoken": "^8.5.1", "lodash": "^4.17.20", "next": "10.0.0", "nonce": "^1.0.4", "react": "17.0.1", "react-dom": "17.0.1", "shopify-nextjs-toolbox": "2.0.0", "yalc": "^1.0.0-pre.53" } }
Thanks in advance!