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

Input Types can't define resolvers #19

Closed
prijindal opened this issue Feb 8, 2017 · 8 comments
Closed

Input Types can't define resolvers #19

prijindal opened this issue Feb 8, 2017 · 8 comments
Assignees
Labels

Comments

@prijindal
Copy link

Running the demo code is giving this error:

Unhandled rejection Error: createUserInput.id field type has a resolve property, but Input Types cannot define resolvers.
    at invariant (/home/prijindal/projects/Ideas/express/express-api/node_modules/graphql/jsutils/invariant.js:19:11)
    at /home/prijindal/projects/Ideas/express/express-api/node_modules/graphql/type/definition.js:657:31
    at Array.forEach (native)
    at GraphQLInputObjectType._defineFieldMap (/home/prijindal/projects/Ideas/express/express-api/node_modules/graphql/type/definition.js:651:16)
    at GraphQLInputObjectType.getFields (/home/prijindal/projects/Ideas/express/express-api/node_modules/graphql/type/definition.js:640:49)
    at /home/prijindal/projects/Ideas/express/express-api/node_modules/graphql/type/schema.js:224:27
    at typeMapReducer (/home/prijindal/projects/Ideas/express/express-api/node_modules/graphql/type/schema.js:229:7)
    at typeMapReducer (/home/prijindal/projects/Ideas/express/express-api/node_modules/graphql/type/schema.js:187:12)
    at Array.reduce (native)
    at /home/prijindal/projects/Ideas/express/express-api/node_modules/graphql/type/schema.js:215:38
    at Array.forEach (native)
    at /home/prijindal/projects/Ideas/express/express-api/node_modules/graphql/type/schema.js:208:29
    at typeMapReducer (/home/prijindal/projects/Ideas/express/express-api/node_modules/graphql/type/schema.js:219:7)
    at Array.reduce (native)
    at new GraphQLSchema (/home/prijindal/projects/Ideas/express/express-api/node_modules/graphql/type/schema.js:95:34)
    at getSchema (/home/prijindal/projects/Ideas/express/express-api/node_modules/graphql-sequelize-crud/lib/index.js:887:10)
@mderid
Copy link

mderid commented Feb 23, 2017

Same here

@respectTheCode
Copy link

same here

@tnrich
Copy link

tnrich commented Apr 21, 2017

Dropping my dependencies to :
"graphql": "^0.8.0",
fixed it.

@amaury1093
Copy link

Any plans to fix this?

@Glavin001
Copy link
Owner

Please provide sample code, such as Sequelize models, which reproduces this issue.

@Glavin001
Copy link
Owner

I am also experiencing this now with:

    "graphql": "^0.11.7",

Here are my logs:

Unhandled rejection Error: createUserInput.id field type has a resolve property, but Input Types cannot define resolvers.
    at invariant (/Users/glavin/Development/HealthForms/packages/api/node_modules/graphql/jsutils/invariant.js:18:11)
    at /Users/glavin/Development/HealthForms/packages/api/node_modules/graphql/type/definition.js:698:58
    at Array.forEach (native)
    at GraphQLInputObjectType._defineFieldMap (/Users/glavin/Development/HealthForms/packages/api/node_modules/graphql/type/definition.js:692:16)
    at GraphQLInputObjectType.getFields (/Users/glavin/Development/HealthForms/packages/api/node_modules/graphql/type/definition.js:681:49)
    at typeMapReducer (/Users/glavin/Development/HealthForms/packages/api/node_modules/graphql/type/schema.js:223:26)
    at typeMapReducer (/Users/glavin/Development/HealthForms/packages/api/node_modules/graphql/type/schema.js:189:12)
    at Array.reduce (native)
    at /Users/glavin/Development/HealthForms/packages/api/node_modules/graphql/type/schema.js:216:36
    at Array.forEach (native)
    at typeMapReducer (/Users/glavin/Development/HealthForms/packages/api/node_modules/graphql/type/schema.js:209:27)
    at Array.reduce (native)
    at new GraphQLSchema (/Users/glavin/Development/HealthForms/packages/api/node_modules/graphql/type/schema.js:97:34)
    at Object.getSchema (/Users/glavin/Development/HealthForms/packages/api/node_modules/graphql-sequelize-crud/lib/index.js:887:10)
    at /Users/glavin/Development/HealthForms/packages/api/dist/index.js:116:43
    at tryCatcher (/Users/glavin/Development/HealthForms/packages/api/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/Users/glavin/Development/HealthForms/packages/api/node_modules/bluebird/js/release/promise.js:512:31)
    at Promise._settlePromise (/Users/glavin/Development/HealthForms/packages/api/node_modules/bluebird/js/release/promise.js:569:18)
    at Promise._settlePromise0 (/Users/glavin/Development/HealthForms/packages/api/node_modules/bluebird/js/release/promise.js:614:10)
    at Promise._settlePromises (/Users/glavin/Development/HealthForms/packages/api/node_modules/bluebird/js/release/promise.js:693:18)
    at Async._drainQueue (/Users/glavin/Development/HealthForms/packages/api/node_modules/bluebird/js/release/async.js:133:16)
    at Async._drainQueues (/Users/glavin/Development/HealthForms/packages/api/node_modules/bluebird/js/release/async.js:143:10)

@Glavin001
Copy link
Owner

Glavin001 commented Oct 15, 2017

@tnrich For some reason I am receiving errors with GraphQL version 0.8.2, which you are using: https://github.com/TeselaGen/graphql-sequelize-crud/blob/master/yarn.lock#L1729

  getSchema
    ✓ should return GraphQL Schema (39ms)
    1) should successfully create records
    2) should successfully create and update single User record
    3) should successfully create and update User records
    4) should successfully create and delete User records
    5) should successfully create and delete single User record
    ✓ should fail to create user with excluded field
    ✓ should fail to create user with excluded field
    ✓ should successfully create custom record with custom mutation


  4 passing (612ms)
  5 failing

  1) getSchema should successfully create records:
     AssertionError: An error occurred: GraphQLError: Cannot read property 'selectionSet' of undefined: expected [ Array(1) ] to equal undefined
      at test/getSchema.test.ts:249:37
      at <anonymous>

  2) getSchema should successfully create and update single User record:
     AssertionError: expected null to be an object
      at test/getSchema.test.ts:498:54
      at <anonymous>

  3) getSchema should successfully create and update User records:
     AssertionError: expected null to be an object
      at test/getSchema.test.ts:600:54
      at <anonymous>

  4) getSchema should successfully create and delete User records:
     AssertionError: expected null to be an object
      at test/getSchema.test.ts:690:54
      at <anonymous>

  5) getSchema should successfully create and delete single User record:
     AssertionError: expected null to be an object
      at test/getSchema.test.ts:777:54
      at <anonymous>



npm ERR! Test failed.  See above for more details.

I have 0.7.2 passing tests though.

It may be an issue with the refactoring I have done with #31.


Any plans to fix this?

I hope to fix this and get everything working on latest GraphQL version.


Update: Turns out the Cannot read property 'selectionSet' of undefined error is from a breaking change in GraphQL: jakepusateri/graphql-list-fields#1 (comment) and jakepusateri/graphql-list-fields@28cbd89
A newer version of graphql-sequelize fixes this: https://github.com/mickhansen/graphql-sequelize/blob/25c9c5089a9ce039ecc8da6c679ab942431d4df6/src/relay.js#L351

However I now have other issues to fix with updating these dependencies. Will take more time.

@Glavin001
Copy link
Owner

Glavin001 commented Oct 16, 2017

Published a big new release, v0.4.1! https://github.com/Glavin001/graphql-sequelize-crud/releases/tag/v0.4.1

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

No branches or pull requests

6 participants