Open cervmi opened 4 years ago
Same problem here 😞
related issue.
i want to use the cli to download + maintain my schema file in src/schema/temp/graphql-schema.json
, and i want to use codegen, so i need to have the following apollo.config.js
:
module.exports = {
client: {
name: 'freestyle-client',
service: {
name: 'freestyle',
localSchemaFile: './src/schema/temp/graphql-schema.json',
},
},
};
however as soon as i define the 'client' field in the config file i find an error with the following command:
npx apollo service:download --endpoint=http://localhost:4000/graphql src/schema/temp/graphql-schema.json
Error:
CLIError: Error in "Loading schema for Unnamed Project": Error: Type "Query" already exists in the schema. It cannot also be defined in this type definition.
...
Any solutions to this problem? I have the same
I solved it finally with proper arguments of apollo:
without authorisation: apollo schema:download graphqlModel\\schemaPublic.json --endpoint=https://localhost:4443/api/public --skipSSLValidation
with authorisation: apollo schema:download graphqlModel\\schemaAdmin.json --endpoint=https://localhost:4443/api/admin --header="Authorization: Bearer bearerString" --skipSSLValidation
My apollo.config.js is
and when I run
apollo client:download-schema schema.json
it returns:Even when URL is not defined in config, it throws same error. But without this file it is not working. Does it looks to another configuration as well? Or where is problem?