"message": "Network error: fetcher is not a function" | Community
Skip to main content
Nikhil-Kumar
Community Advisor
Community Advisor
September 29, 2020
Question

"message": "Network error: fetcher is not a function"

  • September 29, 2020
  • 1 reply
  • 1124 views

I am getting above mentioned error I am using below code snippet to get result from Magento graphql in Node JS:

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

const httpLink = createHttpLink({
uri: 'http://localhost:3001/graphql',
fetch: fetch,
});

const client = new ApolloClient({
link: httpLink,
cache: new InMemoryCache(),
});

var queryField = `query {
countries {
id
available_regions {
name
code
}
}
}

`;

const query = gql(queryField);
var variables = {};

const result = client.query({
    query,
    variables
  });

I tried with apollo-client 3 as well as 2.

There seems to be issue in getting the results.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

1 reply

kautuk_sahni
Community Manager
Community Manager
October 6, 2020

@arunpatidar  @briankasingli @user05162 @andrei_dantsou  any help on this one? 

 

Kautuk Sahni