How to make a call to my own server

5 0 1


I have generated a nodejs app using the cli for the first time.

The app need to send a request to my nodejs server to save something in the database.

So, from the react, I want to fire a request to the server.


await fetch('/product',{method: 'get' });


In the server I added this:


  router.get("/product", async (ctx) => {
    return {}


I am getting the following error:


┃   TypeError: Cannot read property 'map' of undefined
┃       at new AuthScopes (/usr/local/src/products-importer/node_modules/@shopify/shopify-api/dist/auth/scopes/index.js:14:35)
┃       at AuthScopes.equals (/usr/local/src/products-importer/node_modules/@shopify/shopify-api/dist/auth/scopes/index.js:38:21)
┃       at /usr/local/src/products-importer/node_modules/@shopify/koa-shopify-auth/dist/src/verify-request/verify-token.js:23:79
┃       at step (/usr/local/src/products-importer/node_modules/tslib/tslib.js:133:27)
┃       at (/usr/local/src/products-importer/node_modules/tslib/tslib.js:114:57)
┃       at fulfilled (/usr/local/src/products-importer/node_modules/tslib/tslib.js:104:62)
┃       at runMicrotasks (<anonymous>)
┃       at processTicksAndRejections (internal/process/task_queues.js:93:5)​



What is the correct and secured way to make a request from the client to my server?



Replies 3 (3)
Shopify Staff
Shopify Staff
400 64 81

Hey @Avi4 

Just checking that your Node JS app had followed the Oauth process detailed here? Public apps and custom apps must authenticate using the Oauth 2.0 specification in order to use Shopify's API Resources.

The error you have - Cannot read property 'map' of undefined at new AuthScopes (/node_modules/@shopify/shopify-api/dist/auth/scopes/index.js:14:35 -  looks very similar to an AuthScope error that I've seen, that has been thrown in the Node CLI in the past, so just wanted to check with you to see at what particular point this error was thrown - is it after you have followed the Oauth process? Please let me know when you get a second - thanks!


| Shopify |
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution!
5 0 1

I have generated a new app and now this error has disappeared. 


Shopify Partner
272 31 25

i am having this error when i call a function from server.js

Response {type: 'basic', url: '', redirected: true, status: 200, ok: true, …}


my server.js function

//=====================script tags====================//
router.get("/scripttag", verifyRequest(), async(ctx,resp) => {
const { shop, accessToken } = ctx.session;
const url = `https://${shop}/admin/api/2022-01/script_tags.json`;
const src='';

const shopifyHeader = (token)=>({
"Content-Type": "application/json",
const scriptTagBody = JSON.stringify({
script_tag: {
event: 'onload',
//=====================end script tags====================//