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

Version 2.00+ Doesn't work with service and .js config file. #239

Open
bootsmann1995 opened this issue Nov 28, 2024 · 9 comments
Open

Version 2.00+ Doesn't work with service and .js config file. #239

bootsmann1995 opened this issue Nov 28, 2024 · 9 comments

Comments

@bootsmann1995
Copy link

bootsmann1995 commented Nov 28, 2024

My Apollo vscode extention doesn't work using newer versions.

I've created a config file looking like this: (apollo.config.js)

module.exports = { client: { localSchemaFile: "./schema.graphql", service: { name: "datocms-test", url: "<env>", headers: { authorization: "Bearer <env>", }, }, includes: [ "./queries/**/*.gql",], }, };

If i use version 2.00 + the vscode extension gives me this error:
Service stats could not be loaded. This may be because you're missing an apollo.config.js file or it is misconfigured. For more information about configuring Apollo projects, see the guide here (https://go.apollo.dev/t/config).

image

And if I use 1.20.0 it works without changing the config file.
image

@phryneas
Copy link
Member

phryneas commented Dec 3, 2024

That should definitely cause a better error message :/ Do you get any popups?

Generally, the extension supports either a localSchemaFile or a service with a url, and in the case of a localSchemaFile you'd define that inside of service.

So either of these would be valid configurations:

module.exports = {
  client: {
    service: {
      name: "datocms-test",
      url: "<env>",
      headers: { authorization: "Bearer <env>" },
    },
    includes: ["./queries/**/*.gql"],
  },
};

or

module.exports = {
  client: {
    service: {
      name: "datocms-test",
      localSchemaFile: "./schema.graphql",
    },
    includes: ["./queries/**/*.gql"],
  },
};

Could you try those to see if they work for you?

@bootsmann1995
Copy link
Author

bootsmann1995 commented Dec 5, 2024

@phryneas

this is what I tried:

module.exports = {
	client: {
		service: {
			name: "datocms",
			url: process.env.GQL_HOST,
			headers: {
				authorization: `Bearer ${process.env.GQL_TOKEN}`,
			},
		},
		includes: [ "./queries/**/*.gql"],
	},
};

@phryneas
Copy link
Member

phryneas commented Dec 5, 2024

Did it work?

@bootsmann1995
Copy link
Author

@phryneas no :) same error. if i have the same config on 1.20 it works.

@phryneas
Copy link
Member

phryneas commented Dec 5, 2024

Hmm... just as part of the elimination process, does it work if you inline the process.env values as a normal string?

And if that doesn't work, does it work as a apollo.config.json instead?

Just trying to find out which step breaks for you here :)

@bootsmann1995
Copy link
Author

@phryneas tried both, pasting in the actual keys so no process.env. and i tried with a json config file.

@phryneas
Copy link
Member

phryneas commented Dec 5, 2024

Could you set this setting to messages or even verbose and share the output here?

image

@phryneas
Copy link
Member

phryneas commented Dec 5, 2024

Also, basic infos: what version of VSCode are you using and what's your operating system?

@phryneas
Copy link
Member

phryneas commented Dec 5, 2024

If you're a windows user, could you please try the build in #240?

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

2 participants