Apollo-tooling: Unable to resolve project type. Please add either a client or service config.

Created on 18 Jan 2019  ยท  3Comments  ยท  Source: apollographql/apollo-tooling

Receiving error:
Unable to resolve project type. Please add either a client or service config.

and

ENGINE_API_KEY not found

Here is my apollo.config.js file:
module.exports = { client: { service: 'my-service-id', }, };

and .env file:
ENGINE_API_KEY=service:my-service-439:E4VSTiXeFWaSSBgFWXOiSA

This did work at some point but decided to break when I loaded up VSCode today.

vscode ๐Ÿž bug

Most helpful comment

I'm using this extension on my project. It's a monorepo managed with Lerna. For some time now I've been using the multi-root workspace feature so that I could get code completion and validation on my GraphQL operations. The .env and apollo.config.js files are in the subpackage's root:

โ”œโ”€โ”€ api
โ”‚ย ย  โ”œโ”€โ”€ package.json
โ”œโ”€โ”€ lerna.json
โ”œโ”€โ”€ olimat.code-workspace
โ”œโ”€โ”€ package.json
โ””โ”€โ”€ web
    โ”œโ”€โ”€ apollo.config.js
    โ”œโ”€โ”€ .env
    โ”œโ”€โ”€ package.json

If I opened my project as a folder, I'd only get syntax highlighting (I'm not sure, but I think performance statistics was also working). Hence the need to open it as a workspace in VS Code: completion + validation.

With the new version I noticed code completion is working in both folder and workspace modes. But I
also started getting the same error in both modes: Unable to resolve project type. And performance statistics seems to be gone now.

If you want to take a look at the repo you should run npm install and npx lerna bootstrap to set up dependencies.

Take a look at this query field. It's getting a type check error because the extension is loading the 'current' tag rather than the one set in apollo.config.js

All 3 comments

Thanks for taking the time to submit this issue! This is definitely related to some changes we just pushed out, but nothing stands out to me at first glance.

Is there any way you can provide me with a small reproduction case? If not, can you explain your current folder structure with respect to .env and apollo.config.js? I suspect you've got them at the package root, but just want to make a sanity check here.

I'm using this extension on my project. It's a monorepo managed with Lerna. For some time now I've been using the multi-root workspace feature so that I could get code completion and validation on my GraphQL operations. The .env and apollo.config.js files are in the subpackage's root:

โ”œโ”€โ”€ api
โ”‚ย ย  โ”œโ”€โ”€ package.json
โ”œโ”€โ”€ lerna.json
โ”œโ”€โ”€ olimat.code-workspace
โ”œโ”€โ”€ package.json
โ””โ”€โ”€ web
    โ”œโ”€โ”€ apollo.config.js
    โ”œโ”€โ”€ .env
    โ”œโ”€โ”€ package.json

If I opened my project as a folder, I'd only get syntax highlighting (I'm not sure, but I think performance statistics was also working). Hence the need to open it as a workspace in VS Code: completion + validation.

With the new version I noticed code completion is working in both folder and workspace modes. But I
also started getting the same error in both modes: Unable to resolve project type. And performance statistics seems to be gone now.

If you want to take a look at the repo you should run npm install and npx lerna bootstrap to set up dependencies.

Take a look at this query field. It's getting a type check error because the extension is loading the 'current' tag rather than the one set in apollo.config.js

Thanks for reporting this issue. We don't currently support multi-root workspaces, but are tracking its addition in https://github.com/apollographql/apollo-tooling/issues/821. Closing here to keep the multi-root discussions in one place.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

viridia picture viridia  ยท  3Comments

majelbstoat picture majelbstoat  ยท  4Comments

fenech picture fenech  ยท  3Comments

ethansinjin picture ethansinjin  ยท  3Comments

clayne11 picture clayne11  ยท  3Comments