Error when starting Apollo Server

Hello, I’ve got problem with starting my Apollo Server from official Apollo Full-Stack tutorial (chapter 1 - Build a schema).
It gives me the error below:

[nodemon] 1.19.4
[nodemon] to restart at any time, enter `rs`
[nodemon] watching dir(s): *.*
[nodemon] watching extensions: js,mjs,json
[nodemon] starting `node src/index.js`
/Users/michaelrydl/Downloads/fullstack-tutorial/start/server/node_modules/graphql/validation/validate.js:107
    throw new Error(errors.map(function (error) {
    ^

Error: Unknown type "PatchSize". Did you mean "PatchiSize"?
    at assertValidSDL (/Users/michaelrydl/Downloads/fullstack-tutorial/start/server/node_modules/graphql/validation/validate.js:107:11)
    at Object.buildASTSchema (/Users/michaelrydl/Downloads/fullstack-tutorial/start/server/node_modules/graphql/utilities/buildASTSchema.js:45:34)
    at makeExecutableSchema (/Users/michaelrydl/Downloads/fullstack-tutorial/start/server/node_modules/apollo-server/node_modules/apollo-server-core/node_modules/@graphql-tools/schema/index.js:497:26)
    at ApolloServer.constructSchema (/Users/michaelrydl/Downloads/fullstack-tutorial/start/server/node_modules/apollo-server/node_modules/apollo-server-core/dist/ApolloServer.js:312:50)
    at new ApolloServerBase (/Users/michaelrydl/Downloads/fullstack-tutorial/start/server/node_modules/apollo-server/node_modules/apollo-server-core/dist/ApolloServer.js:116:75)
    at new ApolloServer (/Users/michaelrydl/Downloads/fullstack-tutorial/start/server/node_modules/apollo-server/node_modules/apollo-server-express/dist/ApolloServer.js:13:1)
    at new ApolloServer (/Users/michaelrydl/Downloads/fullstack-tutorial/start/server/node_modules/apollo-server/dist/index.js:27:9)
    at Object.<anonymous> (/Users/michaelrydl/Downloads/fullstack-tutorial/start/server/src/index.js:6:16)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
[nodemon] app crashed - waiting for file changes before starting...

and my index.js file with server configuration:

require("dotenv").config();

const { ApolloServer } = require("apollo-server");
const typeDefs = require("./schema");

const server = new ApolloServer({ typeDefs });

server.listen().then(() => {
  console.log(`
      Server is running!
      Listening on port 4000
      Explore at https://studio.apollographql.com/sandbox
    `);
});

Thank you for your help.

This error looks helpful. I think you’ve got a typo in your typeDefs. Have you searched your code for PatchSize and PatchiSize?

1 Like

Yeah, it was a stupid mistake with typo I did. Thank you :slight_smile: