Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: Cannot read property 'some' of undefined #4639

Closed
chrisjaimes opened this issue Oct 9, 2020 · 1 comment
Closed

TypeError: Cannot read property 'some' of undefined #4639

chrisjaimes opened this issue Oct 9, 2020 · 1 comment

Comments

@chrisjaimes
Copy link

chrisjaimes commented Oct 9, 2020

I am getting the following error when building Typedefs in Apollo Server:

return typeDef.definitions.some(definition => definition.kind === language_1.Kind.DIRECTIVE_DEFINITION &&
                                   ^
TypeError: Cannot read property 'some' of undefined

I tried to follow some solutions from here #2961 but still, I am getting the error.

This is how I am creating the schema:

fs.readdirSync(__dirname)
 .filter(dir => { console.log('dir', dir); return dir.indexOf('.') < 0 })
 .forEach((dir) => {
    const tmp = require(path.join(__dirname, dir)).default;
    resolvers = merge(resolvers, tmp.resolvers);
    typeDefs.push(tmp.types);
 });

const schema = new ApolloServer({
  typeDefs,
  resolvers, 
  playground: {
    endpoint: '/graphql',
    settings: {
      'editor.theme': 'light'
    }
  }
});

Version:

    "apollo-server-express": "^2.18.2", 
    "graphql-tools": "^6.2.4",

I opened this repo to reproduce the error https://github.com/chrisjaimes/apollo-server-error. What could I be missing?

@chrisjaimes
Copy link
Author

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 20, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant