Error while executing Magento Graphql query from NodeJS.




Hello everyone,

I want to get the result in my Node JS when I run a specific query on the magento server.
I have used the Apollo libraries to hit the Magento endpoint, but getting below error:

"message": "Encountered a sub-selection on the query, but the store doesn't have an object reference. This should never happen during normal use unless you have custom code that is directly manipulating the store; please file an issue.",

Below is the code snippet that I am using:

const gql = require("graphql-tag");
const ApolloClient = require("apollo-client").ApolloClient;
const fetch = require("node-fetch");
const createHttpLink = require("apollo-link-http").createHttpLink;
const InMemoryCache = require("apollo-cache-inmemory").InMemoryCache;

const httpLink = createHttpLink({
    uri: 'http://localhost:3001/graphql',
    fetch: fetch
  const client = new ApolloClient({
    link: httpLink,
    cache: new InMemoryCache()

var queryField = `query {
        countries {
            available_regions {
    const query = gql(queryField);

    var variables = {};

        const result = client.query({

@Jörg_Hoh @Arun_Patidar  @vanegi @mhaack  Can you guys provide some inputs ?

Accepted Solutions (0)

Answers (0)