Skip to content

There is some bug preventing from generating bindings for app itself #65

Open
@pie6k

Description

@pie6k

Steps to reproduce

Modify .graphqlconfig.yml to:

projects:
  app:
    schemaPath: "src/schema.graphql"
    includes: ["queries/{booking,queries}.graphql"]
    extensions:
      prepare-bundle: src/generated/app.graphql
      endpoints:
        default: "http://localhost:5000"
        prepare-bundle: src/generated/app.graphql
      prepare-binding:
        output: src/generated/app.ts
        generator: graphcool-ts
  database:
    schemaPath: "src/generated/database.graphql"
    includes: ["database/seed.graphql"]
    extensions:
      graphcool: graphcool.yml
      prepare-binding:
        output: src/generated/graphcool.ts
        generator: graphcool-ts

Run yarn prepare

Expected: complie bindings for app schema

Actual: Error:
TypeError: Cannot read property 'type' of undefined when I've found out happens in node_modules/graphql-static-binding/dist/generators/graphcool-ts.js:48:89:

var whereType = field.args.find(function (a) { return a.name === 'where'; }).type.name; 
// field.args is undefined!!!

I was trying to dig a bit deeper but I then I had too little knowledge about project itself to realize what is really going on.

My workaround was changing generator from graphcool-ts to binding-ts and it worked but I have no idea why.

Also, it took me a while to realize I needed to add prepare-bundle: src/generated/app.graphql to app.extensions to have all imports working. My intuition was to add bundle: true to prepare-binding options but it was not working.

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