question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"Upload" defined in resolvers, but not in schema

See original GitHub issue

After passing resolvers into ApolloServer, it adds Upload: Upload to it. This causes the above error when reusing it in makeExecutableSchema

  const server = new ApolloServer({
    typeDefs,
    resolvers,
    dataSources: () => ({
      dsBooks: new DSBooks()
    }),
    context: async ({ req }) => ({ user: await getUser(req.headers.authorization) })
  })

  import { makeExecutableSchema } from 'graphql-tools'
  const schema = makeExecutableSchema({ typeDefs, resolvers })

Currently I work around it by delete resolvers.Upload

My app has no file upload function, so it is very strange to see anything about Upload.

Please fix this problem.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

6reactions
tab00commented, Aug 15, 2018

I merely followed the Apollo Server README which shows passing typedefs and resolvers rather than a schema.

I only needed to call makeExecutableSchema because the ServerOptions argument in SubscriptionServer.create() expects schema, not typedefs and resolvers separately.

I don’t think any of this should be relevant to whether Upload is added to resolvers by default.

2reactions
tab00commented, Aug 15, 2018

You shouldn’t need to define another SubscriptionServer, it’s handled internally by ApolloServer

I’ve been trying to use Apollo Server’s built-in SubscriptionServer (with Meteor’s WebApp HTTP server). Is this the correct way?:

  const server = new ApolloServer({
    typeDefs,
    resolvers,
    dataSources: () => ({
      dsBooks: new DSBooks()
    }),
    context: async ({ req }) => ({ user: await getUser(req.headers.authorization) }),
    uploads: false,
    subscriptions: {
      path: "/subscriptions",
      onConnect: async (connectionParams, webSocket) => {
        console.log(`Subscription client connected using Apollo server's built-in SubscriptionServer.`)
      }
    }
  })

  server.installSubscriptionHandlers(WebApp.httpServer)

The client successfully connects, but gets Subscription error: {"message":"Cannot read property 'headers' of undefined"}.

Read more comments on GitHub >

github_iconTop Results From Across the Web

GraphQL : the object name is defined in resolvers, but not in ...
My mutation is getting an object as argument. So I defined the new Object in the schema and in the resolver using GraphQLObjectType....
Read more >
How to resolve 'X defined in resolvers, but not in schema' with ...
The root cause here is that the babel-plugin-inline-import plugin caches your schema. The resolution is essentially to have BABEL_DISABLE_CACHE=1 in your . env ......
Read more >
'Defined in resolvers, but not in schema' need help! - apollo
Hi everybody, I'm starting with Apollo and hit the following error when defining a new mutation: “Error: “sendResetPasswordEmail” defined in ...
Read more >
Resolvers - Apollo GraphQL Docs
A resolver is a function that's responsible for populating the data for a single field in your schema. It can populate that data...
Read more >
error mutation defined in resolvers, but not in schema
error mutation defined in resolvers, but not in schema ... The reason for the error you're seeing is that you've effectively told makeExecutableSchema...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found