Giter VIP home page Giter VIP logo

Comments (8)

helfer avatar helfer commented on March 29, 2024 1

Agreed. We should make this the default behavior for Apollo Server when no formatError function is provided.

from apollo-server.

helfer avatar helfer commented on March 29, 2024 1

@wzalazar for connectors, are you passing in an object with string keys, eg. { 'collection': collection }. That's the intended usage.

from apollo-server.

helfer avatar helfer commented on March 29, 2024

@lacker Yeah, GraphQL error messages aren't easy to debug. The line and column numbers actually correspond to the query. So whatever field is on the second line of your query has a resolve function which throws that error. From the looks of it the error is from some code that tries to initialize connectors. Are you passing any connectors to Apollo Server, and are they constructors? If not, that might be the problem. If that doesn't help you solve it, you can pass the following function as the formatError argument to Apollo Server (or a variation thereof which gives you a stack trace or whatever other information you need about the error):

function printError(err){
  if(err.originalError){
    console.log(err.originalError);
  } else {
    console.log(err);
  }
  return err;
}

PS: We have a PR that should improve error messages in GraphQL. We hope it will make it into GraphQL-JS soon.

from apollo-server.

lacker avatar lacker commented on March 29, 2024

Mmmm ok I found it. Yeah I really just want the stack trace when something goes wrong, at least when I am running in development mode. That is e.g. how Rails does it. Even if it's just printed out by the server.

from apollo-server.

wzalazar avatar wzalazar commented on March 29, 2024

Hi, I have the same error, could you explain how to fix them?

from apollo-server.

stubailo avatar stubailo commented on March 29, 2024

BTW there's an issue open for the stack trace thing if anyone wants to look at it: #111

from apollo-server.

wzalazar avatar wzalazar commented on March 29, 2024

Thank's you.

I'm new in Apollo, so I try apollo server in Meteor application and my configuration was

const executableSchema = makeExecutableSchema({
  typeDefs: Schema,
  resolvers: Resolvers,
  connectors: Connectors,
});

like show the documentation, and I think the connector was my Meteor collection, My assumption was wrong.
I remove connectors of my configuration and It's works.

Now looks this way

const executableSchema = makeExecutableSchema({
  typeDefs: Schema,
  resolvers: Resolvers,
});

from apollo-server.

wzalazar avatar wzalazar commented on March 29, 2024

If anyone need an example, Meteor + Apollo, I created an repository https://github.com/wzalazar/graphql-meteor

from apollo-server.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.