I am trying to do schema stitching with apollo but I am getting an error every time I use makeExecutableSchema. The error is the following:
../node_modules/graphql-tools/dist/generate/concatenateTypeDefs.js:9:
-> if (typeDef.kind !== undefined)
TypeError: Cannot read property 'kind' of undefined
I have reproduced the problem even when just copying the basic example on Apollo's website
const { ApolloServer, gql, makeExecutableSchema } = require("apollo-server");
const { addMockFunctionsToSchema, mergeSchemas } = require("graphql-tools");
const chirpSchema = makeExecutableSchema({
typeDefs: `
type Chirp {
id: ID!
text: String
authorId: ID!
}
type Query {
chirpById(id: ID!): Chirp
chirpsByAuthorId(authorId: ID!): [Chirp]
}
`
});
addMockFunctionsToSchema({ schema: chirpSchema });
const authorSchema = makeExecutableSchema({
typeDefs: `
type User {
id: ID!
email: String
}
type Query {
userById(id: ID!): User
}
`
});
addMockFunctionsToSchema({ schema: authorSchema });
const schema = mergeSchemas({
schemas: [chirpSchema, authorSchema]
});
const server = new ApolloServer(schema);
server.listen().then(({ url }) => {
console.log(`???? Server ready at ${url}`);
});
What am I doing wrong? However I try I always get the same error when using makeExecutableSchema.