Skip to content

Couldn't add schema extension plugin extend type of another service #15

Open
@yleigh

Description

I would like to add a schema extension plugin in this nodejs Postgraphile server to pointing to another type in another GraghQL service. The other service is running with Apollo Server. Then would like to register both GrqphQL with Apollo Gateway.
However, in my plugin:

const { makeExtendSchemaPlugin, gql } = require("graphile-utils");

const SchemaExtensionPlugin = makeExtendSchemaPlugin(build => {
  // Get any helpers we need from `build`
  const { pgSql: sql, inflection } = build;
  return {
      typeDefs: gql`
        extend type Query {
            ThingLinked: [ThingLinkedProduct]
        }

        type ThingLinkedProduct @key(fields: "id") {
            id: Int!
            name: String
            product: Product
        }

        extend type Product @key(fields: "upc") {
            upc: String!    @external
        }
    `,
      resolvers: {...}
  };
});
  
export default SchemaExtensionPlugin;

Error:

Error: Could not find type named 'Product'.
    at getType (C:\Workspace\EMCP\node_modules\graphile-utils\src\makeExtendSchemaPlugin.ts:516:15)
    at C:\Workspace\EMCP\node_modules\graphile-utils\src\makeExtendSchemaPlugin.ts:755:24

I even tried to add Apollo's buildFederatedSchema API in this extension, got different error.

Is this feature supported?

I'm able to add 'extend type' the other way around. Added 'extend type' from here to the other Apollo Server GraphQL, and Apollo gateway can query this one using nodeId

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions