apollographql / apollographql/apollo-tooling
[apollo-vscode] Apollo server keeps erroring because of duplicate operations even when using excludes
- Dominant language
- TypeScript
- Stars
- 3k
- Forks
- 460
- PR merge metrics
- No merged PRs in 30d
Description
I keep getting this error when editing .graphql files
```
\apollo-language-server\lib\project\base.js:131
throw new Error(`️️There are multiple definitions for the \`${definition.name.value}\` operation. Please rename or remove all operations with the duplicated name before continuing.`);
^
Error: ️️There are multiple definitions for the `TestEstate` operation. Please rename or remove all operations with the duplicated name before continuing.
```
I have TestEstate query operation defined in graphql and types.ts files . the types.ts file is auto generated using graphql-codegen. I think that apollo graphql is not getting excludes right:
apollo.config.js
```
module.exports = {
client: {
service: {
name: 'my-graphql-app',
url: 'http://localhost:3000/graphql',
excludes: ['node_modules/**/*', 'src/types.ts']
//localSchemaFile: './schema.graphql'
}
}
};
```
Contributor guide
Research direction
Start with the provided apollo.config.js and the duplicate-operation error at lib/project/base.js:131; reproduce the Apollo VS Code workflow with src/types.ts generated from GraphQL. Trace how the excludes entry is handled, and consider the issue done when the excluded generated file no longer causes the duplicate TestEstate error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100