apollographql / apollographql/apollo-tooling

Apollo VS Code Extension used in server not detecting schema across multiple files

Open
#1,994 1 comment 1 reaction 0 assignees View on GitHub
:spiral_notepad: component - vscode
Dominant language
TypeScript
Stars
3k
Forks
460
PR merge metrics
No merged PRs in 30d

Description

**Intended outcome:**

I am trying to configure the Apollo VS Code Extension to detect and provide checking on a local schema in a server.

Based on a number of attempts using the docs (https://www.apollographql.com/docs/devtools/apollo-config/#server-projects) and other issues in this repo I still cannot get the schema to be detected.

The `apollo.config.js` defined in the project root. Only the server exists in the project.

```
module.exports = {
includes: [__dirname + "/schema/*.graphql"],
service: {
localSchemaFile: "./schema/schema.graphql",
},
};
```

**Actual outcome:**

There is no change in the `schema.graphql`. I cannot access jump to definition, error checking and highlighting, etc.

**How to reproduce the issue:**

I am using a schema split across multiple `.graphql` using imports such as

```
# import User, RegisterUserInput from "user.graphql"
```
at the top of the file.

I also use graphql-codegen to generate the types of the schema for Typescript type assertion in the src. It has not problems.

**Versions**

Extension `1.16.2`

When I try to use the CLI (`apollo@2.28.2`) I get this error
```
› Error: No graph (i.e. service) found to link to Apollo Graph Manager.
› In order to run this command, please provide a graph ID using the 'apollo.config.js' file.


› For more information on configuring the Apollo CLI, please go to
› https://go.apollo.dev/t/config
error Command failed with exit code 2.
```

Contributor guide

Open the contributing guide

Research direction

Start with the project-root apollo.config.js and the schema/*.graphql files using the reported multi-file import setup. Reproduce with Apollo VS Code Extension 1.16.2 and Apollo CLI 2.28.2, then trace the extension's schema-loading entry point; done means schema detection, jump to definition, error checking, and highlighting work across the split files.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.