shopify-api-js icon indicating copy to clipboard operation
shopify-api-js copied to clipboard

response is not defined

Open shop-fluencer opened this issue 3 years ago • 1 comments
trafficstars

Hello, Why I get this error:

   const test_session = await Shopify.Utils.loadCurrentSession(request, response);
                                                                        ^

ReferenceError: response is not defined

Code:

 const {Shopify, ApiVersion} =  require('@shopify/shopify-api');

 const { Product } = require('@shopify/shopify-api/dist/rest-resources/2022-04/index.js');


 Shopify.Context.initialize({
  API_KEY: 'xxx',
  API_SECRET_KEY: 'xxx',
  SCOPES: ['read_products'],
  HOST_NAME: 'https://storemany.myshopify.com/'.replace(/https:\/\//, ""),
  API_VERSION: ApiVersion.April22,
  IS_EMBEDDED_APP: true,

});


   const test_session = await Shopify.Utils.loadCurrentSession(request, response);
  const d = await Product.all({
    session: test_session
  }) 

shop-fluencer avatar Apr 18 '22 00:04 shop-fluencer

@shop-fluencer have you fixed this issue have the same issue?

Sky-bits avatar Sep 14 '22 12:09 Sky-bits

With what framework is the app being used? E.g., express, koa, etc.? The request/response should be coming from the framework or from Node.

mkevinosullivan avatar Sep 22 '22 19:09 mkevinosullivan

@mkevinosullivan thanks lot for your concern into my query

Expresss js with graphql

i build the shopify app node react base on shopify boiler plate
https://graphql.org/graphql-js/running-an-express-graphql-server/

`

var app = express(); app.use('/graphql', graphqlHTTP({ schema: schema, rootValue: root, graphiql: true, })); app.listen(4000);

`

I can't see any request /response
how do integrate with graphQL with express shopify auth middle ware?

Sky-bits avatar Sep 23 '22 06:09 Sky-bits

This issue is stale because it has been open for 90 days with no activity. It will be closed if no further action occurs in 14 days.

github-actions[bot] avatar Nov 23 '22 02:11 github-actions[bot]

@shop-fluencer we have now released a v6 of the api. May I invite you to migrate to v6 through this guide and let u know if you can still reproduce the issue ? And re open that one if you can still reproduce it ?

cquemin avatar Dec 16 '22 14:12 cquemin