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

There can be only one type named "CacheControlScope" #324

Closed
stevez86 opened this issue May 20, 2019 · 3 comments
Closed

There can be only one type named "CacheControlScope" #324

stevez86 opened this issue May 20, 2019 · 3 comments

Comments

@stevez86
Copy link

I'm using graphql-import and ApolloServer and I'm running into the following error:

Error: There can be only one type named "CacheControlScope".

Enum value "CacheControlScope.PUBLIC" can only be defined once.

Enum value "CacheControlScope.PRIVATE" can only be defined once.

There can be only one directive named "cacheControl".
  at assertValidSDL (/node_modules/graphql/validation/validate.js:89:11)
  at Object.buildASTSchema (/node_modules/graphql/utilities/buildASTSchema.js:78:34)
  at Object.buildSchemaFromTypeDefinitions (/node_modules/graphql-tools/dist/generate/buildSchemaFromTypeDefinitions.js:23:28)
  at Object.makeExecutableSchema (/node_modules/graphql-tools/dist/makeExecutableSchema.js:26:29)
  at new ApolloServerBase (/node_modules/apollo-server-core/dist/ApolloServer.js:162:43)
  at new ApolloServer (/node_modules/apollo-server-express/dist/ApolloServer.js:46:9)
  at Module../src/server.js (/dist/server.js:15214:22)
  at __webpack_require__ (/dist/server.js:683:30)
  at fn (/dist/server.js:60:20)
  at Object.0 (/dist/server.js:15261:18)

Referencing this issue: #153 I had to manually add the following to my schema:

enum CacheControlScope {
  PUBLIC
  PRIVATE
}

directive @cacheControl(
  maxAge: Int
  scope: CacheControlScope
) on OBJECT | FIELD_DEFINITION

For a period of time this was working without error until recently and I started getting the error above. It happens in both importSchema and the webpack plugin. When I print out the typeDefs on my server I see that it's only declared once. Any help on troubleshooting while I keep looking into this would be appreciated.

@stevez86
Copy link
Author

I'm closing this to reference the culprit, ApolloServer apollographql/apollo-server#2428

@gotexis
Copy link

gotexis commented Jun 23, 2019

@stevez86 This seems happening to me, so what was the solution again?

@jimsorock
Copy link

@stevez86 This seems happening to me, so what was the solution again?

Just updated to latest and the check is automatic. No need to implement anything.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants