Open mathiasschopmans opened 4 years ago
Basic Apollo Setup:
package.json
{
"name": "panther-search-service",
"version": "1.0.0",
"main": "index.js",
"author": "AOE <developer@aoe.com>",
"license": "MIT",
"private": true,
"scripts": {
"start": "node index.js",
"dev": "node -r dotenv/config index.js",
"test": "jest"
},
"dependencies": {
"apollo-server": "^2.16.1",
"graphql": "^15.3.0",
}
}
server.js
const { ApolloServer, gql } = require('apollo-server');
// The GraphQL schema
const typeDefs = gql`
type Query {
"A simple type for getting started!"
hello: String
}
`;
// A map of functions which return data for the schema.
const resolvers = {
Query: {
hello: () => 'world',
},
};
const server = new ApolloServer({
typeDefs,
resolvers,
});
server.listen().then(({ url }) => {
console.log(`🚀 Server ready at ${url}`);
});
node server.js
I found a workaround to ignore the creation of CacheControlScope
enum type.
When initializing Apollo with a schema
instead of typeDefs and resolvers, it won't add it.
const { ApolloServer, gql, makeExecutableSchema } = require('apollo-server');
// The GraphQL schema
const typeDefs = gql`
type Query {
"A simple type for getting started!"
hello: String
}
`;
// A map of functions which return data for the schema.
const resolvers = {
Query: {
hello: () => 'world',
},
};
const executableSchema = makeExecutableSchema({
typeDefs,
resolvers,
});
const server = new ApolloServer({
schema: executableSchema,
introspection: true,
});
server.listen().then(({ url }) => {
console.log(`🚀 Server ready at ${url}`);
});
The issue is still valid and seems to be related to https://github.com/hasura/graphql-engine/pull/4821
@mathiasschopmans I had the exact same issue with my Remote Schema endpoints after bumping apollo-server-cloud-functions
and graphql
versions to the latest ones and was able to fix it by first reloading my metadata under the Hasura Metadata Actions section. Just ticked "Reload all remote schemas" and then clicked "Reload", and then I was able to reload each schema individually. Hope that helps!
I fixed it adding a suffix /v1/graphql
to the Remote Schema URL.
Like this:
File: remote_schemas.yaml
- name: YourRemoteSchema
definition:
url: https://yourHasuraApi/v1/graphql
timeout_seconds: 60
headers:
- name: x-hasura-admin-secret
value: "yourSecretHere"
For my current project I want to add two remote services, both using Apollo-Server. When I try to add the second service Hasura complains about a schema mismatch.
It seems that Apollo is adding a internal CacheControlScope-Type, but I can ensure, that they both have the same definition:
Is this behaviour intended?
Maybe related to #5046