You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Basically after the server is instantiated, the schema change process won't run and thus resolvers aren't getting updated.
The issue actually happens in a CMS where, after the user changed the schema, we should update the server accordingly so that introspection and resolving work.
here's a sample of how the process takes effect:
// initial buildletexternal;
let externalServer: any=newApolloServer({introspection: true,playground: true,schema: buildSchema(`type Query { boot: Boolean }`),});pubSub.subscribe("REBUILD_EXTERNAL",async(payload)=>{external=awaitcreateExternal(connection);// this function creates the new schema and the context after a changeexternalServer.schema=external.schema;externalServer.context=external.context;externalServer.schemaDerivedData=externalServer.generateSchemaDerivedData(external.schema);});// to update the schema after first initializationpubSub.publish("REBUILD_EXTERNAL",{name: "SERVER_BOOT"});externalServer.applyMiddleware({
app,path: `${config.path}graphql`,cors: {origin: true,},});
this issue is actually taken from PrimeCMS with some small changes for better readability.
The text was updated successfully, but these errors were encountered:
Updating these fields to change the schema is not part of the Apollo Server API. We refactored the internal storage of these fields in v2.22.
If you want to update your schema over time, you can create an object that obeys the GraphQLService API including the onSchemaChange method and pass it as the gateway argument. While this is designed for use with @apollo/gateway, it is an API that does work with your own objects.
It might also be reasonable for us to expose a public API to let you set your schema that does
if (this.state.phase === 'started') {
this.state.schemaDerivedData = this.generateSchemaDerivedData(schema);
}
Basically after the server is instantiated, the schema change process won't run and thus resolvers aren't getting updated.
The issue actually happens in a CMS where, after the user changed the schema, we should update the server accordingly so that introspection and resolving work.
here's a sample of how the process takes effect:
this issue is actually taken from PrimeCMS with some small changes for better readability.
The text was updated successfully, but these errors were encountered: