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.
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.
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
.envandapollo.config.jsfiles are in the subpackage's root: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 installandnpx lerna bootstrapto 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