Skip to content

couldn't add schema extension plugin #8

@yleigh

Description

@yleigh

This source code works fine if I just changed the connection string to my Postgres db.
However, I would like to use Apollo federation with this. Trying to add my own schema extension plugin, like:

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`  
          type NewType @key(fields: "id") {
              id: Int!
              name: String
              stuff: ExistingType
          }
          extend type ExistingType @key(fields: "upc") {
              upc: String!    @external
          }
      `,
        resolvers: { ... }
    };
  });

module.exports = SchemaExtensionPlugin;

But got error like:

node_modules\graphile-utils\node8plus\makePgSmartTagsPlugin.js:9
    [graphile_build_pg_1.PgEntityKind.CLASS]: "for tables, composite 
types, views and materialized views",
                                      ^

TypeError: Cannot read property 'CLASS' of undefined
    at Object.<anonymous> (C:\Workspace\emcp-gql-federation\nodejs\pg-apollo-server\node_modules\graphile-utils\node8plus\makePgSmartTagsPlugin.js:9:39)
    at Module._compile (internal/modules/cjs/loader.js:1137:30)      
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
    at Module.load (internal/modules/cjs/loader.js:985:32)
    at Function.Module._load (internal/modules/cjs/loader.js:878:14) 
    at Module.require (internal/modules/cjs/loader.js:1025:19)       
    at require (internal/modules/cjs/helpers.js:72:18)
    at Object.<anonymous> (C:\Workspace\emcp-gql-federation\nodejs\pg-apollo-server\node_modules\graphile-utils\node8plus\index.js:24:22) 
    at Module._compile (internal/modules/cjs/loader.js:1137:30)      
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
...

Is this supported here?

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