Cant retrieve products (weird response bug)

New Member
3 0 1

Bug details

Describe the bug

const client = Client.buildClient({
  domain: 'shop.myshopify.com',
  storefrontAccessToken: '-'
})

Fetching products:

client.product.fetchAll().then(res => console.log(res)).catch(err => console.log(err))

And the response:

[
  type: {
    name: 'ProductConnection',
    kind: 'OBJECT',
    fieldBaseTypes: { edges: 'ProductEdge', pageInfo: 'PageInfo' },
    implementsNode: false
  }
]

To Reproduce
Steps to reproduce the behaviour:

  1. Create NextJS project
  2. Make own custom server with node/express or fastify
  3. Use the sdk to fetch products

Expected behavior
Get the products in JSON format

Environment (please complete the following information):

  • OS: MacOS
  • Browser: Chrome
  • SDK Version: 2.9.0
0 Likes
Highlighted
Shopify Staff
Shopify Staff
274 42 47

Hey @nimabrownlee ,

 

My assumption is that the reason why you are getting that specific response is because you are calling console.log() on the JSON object results returned from the Shopify API, rather than first converting the results from the Shopify API to a string first and then logging it to the console. 

 

Try updating your code so that instead of using `console.log(res)`, you use `console.log(JSON.stringify(res))` and see if that helps

Hassain | Developer Support Specialist @ Shopify
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Click Accept as Solution 

0 Likes