Closed Albert-Gao closed 3 years ago
@Albert-Gao Did you ever resolve this? I've been stuck on the same issue for quite some time.
@thiagodebastos Unfortunately, no :(
@thiagodebastos Unfortunately, no :(
Setting documents
to an empty string seems to have done it. I can now successfully execute queries from within VSCode. If that doesn't do it for you, let me know and I will dig deeper into my changes.
I really don't know whats going on, I'm still getting my head around where I am regarding backend vs frontend in NextJS and Apollo, but I am getting there!
// graphql.config.js
module.exports = {
projects: {
default: {
schema: 'http://127.0.0.1:7777/api/graphql',
documents: [],
endpoints: {
default: {
url: 'http://127.0.0.1:7777/api/graphql',
headers: { Authorization: `Bearer ${process.env.SQUARE_API_TOKEN}` },
},
},
},
},
};
@Albert-Gao @thiagodebastos close but if you see in the readme, it's nested in extensions
like this:
module.exports = {
projects: {
default: {
schema: ['./schema.graphql'],
documents: ['./app/**/*.{ts,tsx}'],
extensions: {
endpoints: {
default: {
url: 'http://localhost:4000/graphql',
headers: { Authorization: jwt },
},
},
},
},
},
}
if the endpoint is the same across all projects, you can do this:
module.exports = {
projects: {
default: {
schema: ['./schema.graphql'],
documents: ['./app/**/*.{ts,tsx}']
},
},
extensions: {
endpoints: {
default: {
url: 'http://localhost:4000/graphql',
headers: { Authorization: jwt },
},
},
},
}
this configuration would be treated the same:
module.exports = {
schema: ['./schema.graphql'],
documents: ['./app/**/*.{ts,tsx}'],
extensions: {
endpoints: {
default: {
url: 'http://localhost:4000/graphql',
headers: { Authorization: jwt },
},
},
},
}
fixed the readme, sorry y'all!
My config
Steps:
click the Execute Mutation
Found the error
Error in GraphQL Language Server
Warning: endpoints missing from graphql config. will try 'schema' value(s) instead
Specifications
GraphQL for VSCode Extension Version: latest from store Version: 1.49.1 Commit: 58bb7b2331731bf72587010e943852e13e6fd3cf Date: 2020-09-16T23:21:17.533Z Electron: 9.2.1 Chrome: 83.0.4103.122 Node.js: 12.14.1 V8: 8.3.110.13-electron.0 OS: Darwin x64 19.6.0