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

integration with graphql-sequelize #63

Open
steevhise opened this issue Sep 11, 2019 · 8 comments
Open

integration with graphql-sequelize #63

steevhise opened this issue Sep 11, 2019 · 8 comments

Comments

@steevhise
Copy link

I'm having trouble using graphql-jit in an app that also uses graphql-sequelize, it seems because graphql-sequelize defines a custom type SequelizeJSON which graphql-jit is not recognizing. In queries that use a where criteria that takes a SequelizeJSON input, I get the following error from compileQuery:

 GraphQLError: Variable "$where" expected value of type "SequelizeJSON" which cannot be used as an input type.

Any idea how to avoid this?

@ruiaraujo
Copy link
Collaborator

I will try to take a look. If you could a provide a repro with an example, it would greatly accelerate fixing this. :-)

@steevhise
Copy link
Author

well, it's all in private repos. i've just given you access to the most relevant one so you should be able to get to: https://github.com/freecycle/common-hapi-plugins/blob/45fe43e94e3948f2bf6f7c81a8959952407c2ac6/modules/graphql-wrapper.js#L81
maybe you can at least tell if i'm implementing wrong... thanks!

@ruiaraujo
Copy link
Collaborator

I will try to take a look soon, thanks for sharing.

@ruiaraujo
Copy link
Collaborator

That is all good, the main interesting thing would be to see the schema generation. The error being thrown indicates that the type is not being recognized, have you imported JSONType from sequelize and added it to the schema?

@steevhise
Copy link
Author

Well, I think so. The schema object, when imported in the above file, has the SequelizeJSON type included:

GraphQLSchema {
  __validationErrors: undefined,
  __allowedLegacyNames: [],
  _queryType: RootQueryType,
  _mutationType: RootMutationType,
  _subscriptionType: undefined,
  _directives: [ @include, @skip, @deprecated ],
  astNode: undefined,
  extensionASTNodes: undefined,
  _typeMap:
   [Object: null prototype] {
     RootQueryType: RootQueryType,
     Float: Float,
     SequelizeJSON: SequelizeJSON,
     String: String,
     auth_token: auth_token,
     Date: Date,
     Int: Int,
     access: access,
     user: user,
     invitation: invitation,
     group: group,
     group_file: group_file,
     files_group_file: files_group_file,
     BlobReference: BlobReference,
     group_admin: group_admin,
     group_auto_email: group_auto_email,
     group_event: group_event,
     group_link: group_link,
     group_membership: group_membership,
     group_messagemaker_pref: group_messagemaker_pref,
     group_note: group_note,
     group_preference: group_preference,
     group_digest_queue: group_digest_queue,
     moderator_preference: moderator_preference,
     hotwords_group: hotwords_group,
     postalcode_au_group: postalcode_au_group,
     postalcode_ca_group: postalcode_ca_group,
     postalcode_nz_group: postalcode_nz_group,
     files_group_logo: files_group_logo,
     region: region,
     country: country,
     zipcode_region: zipcode_region,
     zipcode_group: zipcode_group,
     group_activity_log: group_activity_log,
     group_activity: group_activity,
     group_status_history: group_status_history,
     group_status: group_status,
     thread: thread,
     internal_message: internal_message,
     thread_message: thread_message,
     post: post,
     post_type: post_type,
     posts_static: posts_static,
     files_post_image: files_post_image,
     post_tag: post_tag,
     tag: tag,
     alert: alert,
     post_sharing: post_sharing,
     user_note: user_note,
     user_static: user_static,
     user_info: user_info,
     files_user_image: files_user_image,
     friend: friend,
     email_type: email_type,
     privilege_type: privilege_type,
     banned_email_address: banned_email_address,
     cafe_group: cafe_group,
     catalyst_session: catalyst_session,
     email_bounce: email_bounce,
     email_bounce_type: email_bounce_type,
     groups_alias: groups_alias,
     groups_yahoo_info: groups_yahoo_info,
     hotwords_reply: hotwords_reply,
     hotwords_system: hotwords_system,
     invitations_non_myf: invitations_non_myf,
     legacy_group_owner: legacy_group_owner,
     page: page,
     password_reset_token: password_reset_token,
     postalcode_nz_region: postalcode_nz_region,
     postalcode_uk_group: postalcode_uk_group,
     postalcode_uk_region: postalcode_uk_region,
     sponsor: sponsor,
     ukgroup: ukgroup,
     user_email_type: user_email_type,
     RootMutationType: RootMutationType,
     mutation_auth_token: mutation_auth_token,
     mutation_access: mutation_access,
     mutation_alert: mutation_alert,
     mutation_banned_email_address: mutation_banned_email_address,
     mutation_cafe_group: mutation_cafe_group,
     mutation_catalyst_session: mutation_catalyst_session,
     mutation_country: mutation_country,
     mutation_email_type: mutation_email_type,
     mutation_email_bounce: mutation_email_bounce,
     mutation_email_bounce_type: mutation_email_bounce_type,
     mutation_files_group_file: mutation_files_group_file,
     InputBlobReference: InputBlobReference,
     mutation_files_group_logo: mutation_files_group_logo,
     mutation_files_post_image: mutation_files_post_image,
     mutation_files_user_image: mutation_files_user_image,
     mutation_friend: mutation_friend,
     mutation_group: mutation_group,
     mutation_group_activity: mutation_group_activity,
     mutation_group_activity_log: mutation_group_activity_log,
     mutation_group_admin: mutation_group_admin,
     mutation_group_event: mutation_group_event,
     mutation_group_file: mutation_group_file,
     mutation_group_link: mutation_group_link,
     mutation_group_membership: mutation_group_membership,
     mutation_group_messagemaker_pref: mutation_group_messagemaker_pref,
     mutation_group_note: mutation_group_note,
     mutation_group_status: mutation_group_status,
     mutation_group_status_history: mutation_group_status_history,
     mutation_groups_alias: mutation_groups_alias,
     mutation_groups_yahoo_info: mutation_groups_yahoo_info,
     mutation_hotwords_group: mutation_hotwords_group,
     mutation_hotwords_reply: mutation_hotwords_reply,
     mutation_hotwords_system: mutation_hotwords_system,
     mutation_internal_message: mutation_internal_message,
     mutation_invitation: mutation_invitation,
     mutation_invitations_non_myf: mutation_invitations_non_myf,
     mutation_legacy_group_owner: mutation_legacy_group_owner,
     mutation_page: mutation_page,
     mutation_password_reset_token: mutation_password_reset_token,
     mutation_post: mutation_post,
     mutation_post_sharing: mutation_post_sharing,
     mutation_posts_static: mutation_posts_static,
     mutation_post_tag: mutation_post_tag,
     mutation_post_type: mutation_post_type,
     mutation_postalcode_nz_region: mutation_postalcode_nz_region,
     mutation_postalcode_uk_group: mutation_postalcode_uk_group,
     mutation_postalcode_uk_region: mutation_postalcode_uk_region,
     mutation_privilege_type: mutation_privilege_type,
     mutation_region: mutation_region,
     mutation_sponsor: mutation_sponsor,
     mutation_tag: mutation_tag,
     mutation_thread: mutation_thread,
     mutation_thread_message: mutation_thread_message,
     mutation_ukgroup: mutation_ukgroup,
     mutation_user: mutation_user,
     mutation_user_email_type: mutation_user_email_type,
     mutation_user_info: mutation_user_info,
     mutation_user_static: mutation_user_static,
     mutation_user_note: mutation_user_note,
     mutation_zipcode_group: mutation_zipcode_group,
     mutation_zipcode_region: mutation_zipcode_region,
     JSONInput: JSONInput,
     WhereResult_auth_token: WhereResult_auth_token,
     WhereResult_access: WhereResult_access,
     WhereResult_alert: WhereResult_alert,
     WhereResult_banned_email_address: WhereResult_banned_email_address,
     WhereResult_cafe_group: WhereResult_cafe_group,
     WhereResult_catalyst_session: WhereResult_catalyst_session,
     WhereResult_country: WhereResult_country,
     WhereResult_email_type: WhereResult_email_type,
     WhereResult_email_bounce: WhereResult_email_bounce,
     WhereResult_email_bounce_type: WhereResult_email_bounce_type,
     WhereResult_files_group_file: WhereResult_files_group_file,
     WhereResult_files_group_logo: WhereResult_files_group_logo,
     WhereResult_files_post_image: WhereResult_files_post_image,
     WhereResult_files_user_image: WhereResult_files_user_image,
     WhereResult_friend: WhereResult_friend,
     WhereResult_group: WhereResult_group,
     WhereResult_group_activity: WhereResult_group_activity,
     WhereResult_group_activity_log: WhereResult_group_activity_log,
     WhereResult_group_admin: WhereResult_group_admin,
     mutation_group_auto_email: mutation_group_auto_email,
     WhereResult_group_auto_email: WhereResult_group_auto_email,
     mutation_group_digest_queue: mutation_group_digest_queue,
     WhereResult_group_digest_queue: WhereResult_group_digest_queue,
     WhereResult_group_event: WhereResult_group_event,
     WhereResult_group_file: WhereResult_group_file,
     WhereResult_group_link: WhereResult_group_link,
     WhereResult_group_membership: WhereResult_group_membership,
     WhereResult_group_messagemaker_pref: WhereResult_group_messagemaker_pref,
     WhereResult_group_note: WhereResult_group_note,
     mutation_group_preference: mutation_group_preference,
     WhereResult_group_preference: WhereResult_group_preference,
     WhereResult_group_status: WhereResult_group_status,
     WhereResult_group_status_history: WhereResult_group_status_history,
     WhereResult_groups_alias: WhereResult_groups_alias,
     WhereResult_groups_yahoo_info: WhereResult_groups_yahoo_info,
     WhereResult_hotwords_group: WhereResult_hotwords_group,
     WhereResult_hotwords_reply: WhereResult_hotwords_reply,
     WhereResult_hotwords_system: WhereResult_hotwords_system,
     WhereResult_internal_message: WhereResult_internal_message,
     WhereResult_invitation: WhereResult_invitation,
     WhereResult_invitations_non_myf: WhereResult_invitations_non_myf,
     WhereResult_legacy_group_owner: WhereResult_legacy_group_owner,
     mutation_moderator_preference: mutation_moderator_preference,
     WhereResult_moderator_preference: WhereResult_moderator_preference,
     WhereResult_page: WhereResult_page,
     WhereResult_password_reset_token: WhereResult_password_reset_token,
     WhereResult_post: WhereResult_post,
     WhereResult_post_sharing: WhereResult_post_sharing,
     WhereResult_posts_static: WhereResult_posts_static,
     WhereResult_post_tag: WhereResult_post_tag,
     WhereResult_post_type: WhereResult_post_type,
     mutation_postalcode_au_group: mutation_postalcode_au_group,
     WhereResult_postalcode_au_group: WhereResult_postalcode_au_group,
     mutation_postalcode_ca_group: mutation_postalcode_ca_group,
     WhereResult_postalcode_ca_group: WhereResult_postalcode_ca_group,
     mutation_postalcode_nz_group: mutation_postalcode_nz_group,
     WhereResult_postalcode_nz_group: WhereResult_postalcode_nz_group,
     WhereResult_postalcode_nz_region: WhereResult_postalcode_nz_region,
     WhereResult_postalcode_uk_group: WhereResult_postalcode_uk_group,
     WhereResult_postalcode_uk_region: WhereResult_postalcode_uk_region,
     WhereResult_privilege_type: WhereResult_privilege_type,
     WhereResult_region: WhereResult_region,
     WhereResult_sponsor: WhereResult_sponsor,
     WhereResult_tag: WhereResult_tag,
     WhereResult_thread: WhereResult_thread,
     WhereResult_thread_message: WhereResult_thread_message,
     WhereResult_ukgroup: WhereResult_ukgroup,
     WhereResult_user: WhereResult_user,
     WhereResult_user_email_type: WhereResult_user_email_type,
     WhereResult_user_info: WhereResult_user_info,
     WhereResult_user_static: WhereResult_user_static,
     WhereResult_user_note: WhereResult_user_note,
     WhereResult_zipcode_group: WhereResult_zipcode_group,
     WhereResult_zipcode_region: WhereResult_zipcode_region,
     DeleteResult: DeleteResult,
     __Schema: __Schema,
     __Type: __Type,
     __TypeKind: __TypeKind,
     Boolean: Boolean,
     __Field: __Field,
     __InputValue: __InputValue,
     __EnumValue: __EnumValue,
     __Directive: __Directive,
     __DirectiveLocation: __DirectiveLocation },
  _possibleTypeMap: [Object: null prototype] {},
  _implementations: [Object: null prototype] {} }

@steevhise
Copy link
Author

actually the problem appears to be bigger. I just noticed that I also get failures for other queries with errors involving other types. For example:
Error: Can only create List of a GraphQLType but got: String.
Error: Can only create NonNull of a Nullable GraphQLType but got: Int

@ruiaraujo
Copy link
Collaborator

I am assuming that with graphql-js, everything is working smoothly?

I am not seeing who can be throwing that error. I don't find that string anywhere in the code base.

@steevhise
Copy link
Author

yes. without graphql-jit everything is working, though i have performance problems (which is why i'm trying jit)

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

2 participants