Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

425
Views
Error: Expected undefined to be a GraphQL schema on hello world

Below is my simple graph ql hellow rold code which i directly used from graphql official docs toget started, somehow its giving me error: Expected undefined to be a GraphQL schema on hello world


var schema = buildSchema(`
  type Query {
    hello: String
  }
`);

var root = { hello: () => "Hello world!" };

graphql(schema, "{ hello }", root).then((response) => {
  console.log(response);
});
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Seems the documentation is wrong. It needs to be updated, Can you try updating the code like below?

From

graphql(schema, "{ hello }", root).then((response) => {
  console.log(response);
});

To

graphql({
    schema: schema, 
    source: '{ hello }', 
    rootValue: root
}).then((response) => {
  console.log(response);
});
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!