Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
yleigh opened this issue Jul 28, 2020 · 0 comments
Open

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

yleigh opened this issue Jul 28, 2020 · 0 comments

Comments

@yleigh
Copy link

yleigh commented Jul 28, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant